Files
automatisch/packages/backend/src/apps/notion/common/get-current-user.ts
2023-06-13 05:56:33 +00:00

18 lines
402 B
TypeScript

import { IGlobalVariable, IJSONObject } from '@automatisch/types';
type Owner = {
user: {
id: string
}
}
const getCurrentUser = async ($: IGlobalVariable): Promise<IJSONObject> => {
const userId = ($.auth.data.owner as Owner).user.id;
const response = await $.http.get(`/v1/users/${userId}`);
const currentUser = response.data;
return currentUser;
};
export default getCurrentUser;