11 lines
440 B
TypeScript
Raw Normal View History

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