Studio: read auth bearer from the correct localStorage key (unsloth_auth_token)
This commit is contained in:
parent
60b002f1ea
commit
fff46cd462
1 changed files with 3 additions and 6 deletions
|
|
@ -295,15 +295,12 @@ function buildHtmlSrcDoc(source: string): string {
|
|||
// via POST; the returned random-token URL becomes the iframe ``src``.
|
||||
const HTML_PREVIEW_API = "/api/preview/html";
|
||||
|
||||
// Read the bearer the same way the rest of the app does. Pulled lazily to
|
||||
// avoid any import cycle while keeping the auth-key contract in one place.
|
||||
function getStoredAccessToken(): string | null {
|
||||
// Mirrors the bearer storage used by features/auth/. We avoid the import
|
||||
// cycle by reading sessionStorage / localStorage directly.
|
||||
if (typeof window === "undefined") return null;
|
||||
try {
|
||||
return (
|
||||
window.sessionStorage.getItem("unsloth.access_token") ??
|
||||
window.localStorage.getItem("unsloth.access_token")
|
||||
);
|
||||
return window.localStorage.getItem("unsloth_auth_token");
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue