mirror of
https://github.com/datahub-project/datahub.git
synced 2025-08-10 10:17:58 +00:00

* Module consolidation on datahub-web - clean up to some OS logic from previous update - initial implementation of virtual assistant * Fix accidental change to datahub user module license
19 lines
888 B
TypeScript
19 lines
888 B
TypeScript
import { getApiRoot, ApiVersion } from '@datahub/utils/api/shared';
|
|
import { getJSON } from '@datahub/utils/api/fetcher';
|
|
import { ICorpUserInfo } from '@datahub/metadata-types/types/entity/person/person-entity';
|
|
import { IUser } from '@datahub/metadata-types/types/common/user';
|
|
|
|
const currentUserUrl = `${getApiRoot(ApiVersion.v2)}/user/me`;
|
|
|
|
/**
|
|
* Requests the currently logged in user and returns that user
|
|
*/
|
|
export const currentUser = (): Promise<ICorpUserInfo> => getJSON({ url: currentUserUrl });
|
|
|
|
/**
|
|
* Because the open source midtier is currently lagging behind, we need to have a handler for the previous /user/me
|
|
* endpoint as otherwise it causes an issue with logging in on the open source frontend
|
|
*/
|
|
export const currentUserDeprecated = (): Promise<IUser> =>
|
|
getJSON({ url: `${getApiRoot(ApiVersion.v1)}/user/me` }).then(({ user }: { user: IUser }): IUser => user);
|