fix: redirect to login on code change

This commit is contained in:
Rotimi Best
2023-11-30 14:25:14 +03:00
parent f84a60d02a
commit e815c93354
2 changed files with 14 additions and 2 deletions
@@ -22,3 +22,15 @@ export const getSupabase = (config?: ConfigType) => {
return supabase;
};
export const isSupabaseTokenInLocalStorage = () => {
for (let i = 0; i < localStorage.length; i++) {
const key = localStorage.key(i);
if (key === null) continue; // Skip if null (shouldn't happen)
if (/sb-[\w-]+-auth-token/.test(key)) {
return true;
}
}
return false;
};