Fix TypeScript error in authenticate route
Add saveToken() method to authenticationSession for saving standalone JWT tokens without requiring a full AuthenticationResponse object. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,7 @@ const AuthenticatePage = () => {
|
|||||||
} else if (token) {
|
} else if (token) {
|
||||||
// Handle standalone JWT token (from embedded mode new tab)
|
// Handle standalone JWT token (from embedded mode new tab)
|
||||||
// Save token directly to localStorage for persistence in new tabs
|
// Save token directly to localStorage for persistence in new tabs
|
||||||
authenticationSession.saveResponse({ token }, false);
|
authenticationSession.saveToken(token);
|
||||||
navigate(redirectTo);
|
navigate(redirectTo);
|
||||||
}
|
}
|
||||||
}, [response, token, redirectTo, navigate]);
|
}, [response, token, redirectTo, navigate]);
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ export const authenticationSession = {
|
|||||||
ApStorage.getInstance().setItem(tokenKey, response.token);
|
ApStorage.getInstance().setItem(tokenKey, response.token);
|
||||||
window.dispatchEvent(new Event('storage'));
|
window.dispatchEvent(new Event('storage'));
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Save a standalone JWT token directly.
|
||||||
|
* Used for auto-authentication when opening new tabs from embedded mode.
|
||||||
|
*/
|
||||||
|
saveToken(token: string) {
|
||||||
|
ApStorage.getInstance().setItem(tokenKey, token);
|
||||||
|
window.dispatchEvent(new Event('storage'));
|
||||||
|
},
|
||||||
isJwtExpired(token: string): boolean {
|
isJwtExpired(token: string): boolean {
|
||||||
if (!token) {
|
if (!token) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user