mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-18 14:52:06 +00:00

Co-authored-by: Harshal Sheth <harshal@acryl.io> Co-authored-by: Dexter Lee <dexter@acryl.io> Co-authored-by: Gabe Lyons <itsgabelyons@gmail.com>
15 lines
478 B
TypeScript
15 lines
478 B
TypeScript
import Cookies from 'js-cookie';
|
|
import { makeVar } from '@apollo/client';
|
|
import { GlobalCfg } from '../../conf';
|
|
import analytics from '../analytics';
|
|
|
|
export const checkAuthStatus = (): boolean => {
|
|
const isAuthenticated = !!Cookies.get(GlobalCfg.CLIENT_AUTH_COOKIE);
|
|
if (isAuthenticated) {
|
|
analytics.identify(Cookies.get(GlobalCfg.CLIENT_AUTH_COOKIE) as string);
|
|
}
|
|
return isAuthenticated;
|
|
};
|
|
|
|
export const isLoggedInVar = makeVar(checkAuthStatus());
|