mirror of
https://github.com/MetaFam/TheGame.git
synced 2026-01-25 06:08:03 -05:00
* Create "me" view for logged in user * Implement user auth on web * Fix type errors * Setup static regeneration * Disable next export * Address PR feedback
15 lines
454 B
TypeScript
15 lines
454 B
TypeScript
const STORAGE_KEY = 'metagame-auth-token';
|
|
|
|
export const getTokenFromStore = (): string | null =>
|
|
typeof window === 'undefined' ? null : localStorage.getItem(STORAGE_KEY);
|
|
|
|
export const setTokenInStore = (token: string): void => {
|
|
if (typeof window === 'undefined') return;
|
|
localStorage.setItem(STORAGE_KEY, token);
|
|
};
|
|
|
|
export const clearToken = (): void => {
|
|
if (typeof window === 'undefined') return;
|
|
localStorage.removeItem(STORAGE_KEY);
|
|
};
|