fix(FE) : fix store token

This commit is contained in:
Yusron alamsyah
2026-02-24 14:33:16 +07:00
parent b122aa6dad
commit 23f668ae3f
7 changed files with 134 additions and 101 deletions
+16
View File
@@ -52,6 +52,22 @@ export function deleteSession(sessionId: string): void {
sessions.delete(sessionId);
}
export function updateSession(sessionId: string, updates: Partial<SessionData>): boolean {
const session = sessions.get(sessionId);
if (!session) {
return false;
}
// Update the session with new data
const updatedSession = {
...session,
...updates,
};
sessions.set(sessionId, updatedSession);
return true;
}
// Helper function to get session from cookie (for use in API handlers)
export async function getSessionFromCookie(event: any): Promise<SessionData | null> {
const sessionId = getCookie(event, 'user_session');