From 8f7c20cb4bb074d64e560b64aee86fbaa62b1473 Mon Sep 17 00:00:00 2001 From: Aroy-Art Date: Mon, 3 Mar 2025 21:33:31 +0100 Subject: [PATCH] Add: redirect local storage var after login --- frontend/src/services/auth.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/services/auth.ts b/frontend/src/services/auth.ts index a61a6d3..9c5485f 100644 --- a/frontend/src/services/auth.ts +++ b/frontend/src/services/auth.ts @@ -92,6 +92,10 @@ export const login = async (username: string, password: string) => { // Logout function export const logout = () => { + // Store the current path before redirecting to login + localStorage.setItem("redirect_after_login", window.location.pathname); + + // Clear tokens and redirect to login page localStorage.removeItem("access_token"); localStorage.removeItem("refresh_token"); window.location.href = "/user/login"; // Redirect to login page