hfcron / src /lib /auth.ts
Ajitdoval's picture
Create src/lib/auth.ts
9a584ee verified
Raw
History Blame Contribute Delete
471 Bytes
// Safe checks for Next.js SSR environment
export const setToken = (token: string) => {
if (typeof window !== "undefined") {
localStorage.setItem("hf_cron_token", token);
}
};
export const getToken = (): string | null => {
if (typeof window !== "undefined") {
return localStorage.getItem("hf_cron_token");
}
return null;
};
export const removeToken = () => {
if (typeof window !== "undefined") {
localStorage.removeItem("hf_cron_token");
}
};