mirror of
https://github.com/p-stream/providers.git
synced 2026-05-12 19:20:58 +00:00
get feb token from auth
This commit is contained in:
parent
b16f20012b
commit
c8cffb6111
2 changed files with 7 additions and 3 deletions
|
|
@ -15,7 +15,7 @@ const getRegion = (): string | null => {
|
||||||
const parsed = JSON.parse(regionData);
|
const parsed = JSON.parse(regionData);
|
||||||
return parsed?.state?.region ?? null;
|
return parsed?.state?.region ?? null;
|
||||||
} catch (e) {
|
} 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;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,13 @@ import { MovieScrapeContext, ShowScrapeContext } from '@/utils/context';
|
||||||
|
|
||||||
const getUserToken = (): string | null => {
|
const getUserToken = (): string | null => {
|
||||||
try {
|
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) {
|
} catch (e) {
|
||||||
console.warn('Unable to access localStorage:', e);
|
console.warn('Unable to access localStorage or parse auth data:', e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue