mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-16 21:31:10 -05:00
🐛 fix(redirect): Update redirect URL logic to ensure proper handling of OAuth and auth paths
This commit is contained in:
parent
9227411d74
commit
795476209a
@ -38,15 +38,21 @@ export function setRedirectUrl(value?: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getRedirectUrl() {
|
export function getRedirectUrl() {
|
||||||
return sessionStorage.getItem('redirect-url') ?? '/dashboard';
|
let url = sessionStorage.getItem('redirect-url') ?? '/dashboard';
|
||||||
|
if (url.startsWith('/oauth/') || url.startsWith('/auth')) {
|
||||||
|
url = '/dashboard';
|
||||||
|
}
|
||||||
|
if (url) {
|
||||||
|
sessionStorage.removeItem('redirect-url');
|
||||||
|
return url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Logout() {
|
export function Logout() {
|
||||||
if (!isBrowser()) return;
|
if (!isBrowser()) return;
|
||||||
cookies.remove('Authorization');
|
cookies.remove('Authorization');
|
||||||
const pathname = location.pathname;
|
const pathname = location.pathname;
|
||||||
console.log(pathname);
|
if (!['', '/', '/auth', '/tos'].includes(pathname) && !pathname.startsWith('/oauth/')) {
|
||||||
if (!['', '/', '/auth', '/tos'].includes(pathname) || !pathname.includes('/oauth/')) {
|
|
||||||
setRedirectUrl(location.pathname);
|
setRedirectUrl(location.pathname);
|
||||||
location.href = `/auth`;
|
location.href = `/auth`;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user