get feb token from auth

This commit is contained in:
Pas 2025-04-18 19:46:20 -06:00
parent b16f20012b
commit c8cffb6111
2 changed files with 7 additions and 3 deletions

View file

@ -15,7 +15,7 @@ const getRegion = (): string | null => {
const parsed = JSON.parse(regionData);
return parsed?.state?.region ?? null;
} catch (e) {
console.warn('Unable to access or parse region from localStorage:', e);
console.warn('Unable to access localStorage or parse auth data:', e);
return null;
}
};

View file

@ -4,9 +4,13 @@ import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
const getUserToken = (): string | null => {
try {
return typeof window !== 'undefined' ? window.localStorage.getItem('febbox_ui_token') : null;
if (typeof window === 'undefined') return null;
const authData = window.localStorage.getItem('__MW::auth');
if (!authData) return null;
const parsedAuth = JSON.parse(authData);
return parsedAuth?.state?.febboxToken || null;
} catch (e) {
console.warn('Unable to access localStorage:', e);
console.warn('Unable to access localStorage or parse auth data:', e);
return null;
}
};