mirror of
https://github.com/perfect-panel/ppanel-web.git
synced 2026-02-06 11:40:28 -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() {
|
||||
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() {
|
||||
if (!isBrowser()) return;
|
||||
cookies.remove('Authorization');
|
||||
const pathname = location.pathname;
|
||||
console.log(pathname);
|
||||
if (!['', '/', '/auth', '/tos'].includes(pathname) || !pathname.includes('/oauth/')) {
|
||||
if (!['', '/', '/auth', '/tos'].includes(pathname) && !pathname.startsWith('/oauth/')) {
|
||||
setRedirectUrl(location.pathname);
|
||||
location.href = `/auth`;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user