19 lines
493 B
TypeScript
19 lines
493 B
TypeScript
import { createState } from '@ui/utilities/state/utils/createState';
|
|
|
|
import { AuthTokenPair } from '~/generated/graphql';
|
|
import { cookieStorageEffect } from '~/utils/recoil-effects';
|
|
export const tokenPairState = createState<AuthTokenPair | null>({
|
|
key: 'tokenPairState',
|
|
defaultValue: null,
|
|
effects: [
|
|
cookieStorageEffect(
|
|
'tokenPair',
|
|
{},
|
|
{
|
|
validateInitFn: (payload: AuthTokenPair) =>
|
|
Boolean(payload['accessToken']),
|
|
},
|
|
),
|
|
],
|
|
});
|