2020-08-26 15:44:50 -07:00
|
|
|
import { getApiRoot, ApiVersion } from '@datahub/utils/api/shared';
|
2019-08-31 20:51:14 -07:00
|
|
|
import { getJSON } from '@datahub/utils/api/fetcher';
|
2020-08-26 15:44:50 -07:00
|
|
|
import { ICorpUserInfo } from '@datahub/metadata-types/types/entity/person/person-entity';
|
2019-08-31 20:51:14 -07:00
|
|
|
|
2020-08-26 15:44:50 -07:00
|
|
|
const currentUserUrl = `${getApiRoot(ApiVersion.v1)}/user/me`;
|
2019-08-31 20:51:14 -07:00
|
|
|
|
|
|
|
/**
|
2020-08-26 15:44:50 -07:00
|
|
|
* Requests the currently logged in user and returns that user
|
2019-08-31 20:51:14 -07:00
|
|
|
*/
|
2020-08-26 15:44:50 -07:00
|
|
|
export const currentUser = (): Promise<ICorpUserInfo> => getJSON({ url: currentUserUrl });
|