mirror of
https://github.com/umami-software/umami.git
synced 2025-12-06 01:18:00 +01:00
fix: Redirect loop on auth failure
This commit is contained in:
parent
6ba9c1c40c
commit
1879c161ee
2 changed files with 3 additions and 7 deletions
|
|
@ -9,18 +9,14 @@ import { MobileNav } from '@/app/(main)/MobileNav';
|
|||
export function App({ children }) {
|
||||
const { user, isLoading, error } = useLoginQuery();
|
||||
const config = useConfig();
|
||||
const { pathname, router } = useNavigation();
|
||||
const { pathname } = useNavigation();
|
||||
|
||||
if (isLoading || !config) {
|
||||
return <Loading placement="absolute" />;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
if (process.env.cloudMode) {
|
||||
window.location.href = '/login';
|
||||
} else {
|
||||
router.push('/login');
|
||||
}
|
||||
window.location.href = '/login';
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ export function LogoutPage() {
|
|||
async function logout() {
|
||||
await post('/auth/logout');
|
||||
|
||||
router.push('/login');
|
||||
window.location.href = '/login';
|
||||
}
|
||||
|
||||
removeClientAuthToken();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue