twenty/packages/twenty-front/src/modules/apollo/utils/getTokenPair.ts

11 lines
366 B
TypeScript
Raw Normal View History

import { cookieStorage } from '~/utils/cookie-storage';
import { isDefined } from 'twenty-shared/utils';
import { AuthTokenPair } from '~/generated/graphql';
export const getTokenPair = () => {
const stringTokenPair = cookieStorage.getItem('tokenPair');
return isDefined(stringTokenPair)
? (JSON.parse(stringTokenPair) as AuthTokenPair)
: undefined;
};