fix(auth): восстанавливать раздел и фильтры после входа Portal

This commit is contained in:
Denozordec committed 2026-10-13 16:09:27 +07:00
1 parent 199910eceb
commit 46de87e213
15 files changed
+275 -17

No files matched your search

+6 -2
View File
@@ -1,4 +1,5 @@
/** Portal JWT storage + claims helpers for MikrotikManager. */
import { safeAuthReturnPath } from "./auth-return-path"
const TOKEN_KEY = "mmapp_token"
const HANDOFF_KEY = "mmapp_auth_401_handoff"
@@ -125,9 +126,12 @@ export function redirectToPortalLogin(returnTo?: string): boolean {
return false
}
markPortalHandoff()
const callback = returnTo ?? `${window.location.origin}/auth/callback`
const callback = new URL(returnTo ?? `${window.location.origin}/auth/callback`)
const next = safeAuthReturnPath(callback.searchParams.get("next")) ??
safeAuthReturnPath(window.location.pathname + window.location.search)
if (next) callback.searchParams.set("next", next)
const url = new URL(authPortalUrl())
url.searchParams.set("return_to", callback)
url.searchParams.set("return_to", callback.toString())
window.location.assign(url.toString())
return true
}