mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 06:37:18 +01:00
Fixed login redirect.
This commit is contained in:
parent
326bc9f8fa
commit
424f3e5323
2 changed files with 3 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ import useApi from 'components/hooks/useApi';
|
|||
import useUser from 'components/hooks/useUser';
|
||||
|
||||
export function useRequireLogin(handler: (data?: object) => void) {
|
||||
const router = useRouter();
|
||||
const { basePath } = useRouter();
|
||||
const { get } = useApi();
|
||||
const { user, setUser } = useUser();
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ export function useRequireLogin(handler: (data?: object) => void) {
|
|||
|
||||
setUser(typeof handler === 'function' ? handler(data) : (data as any)?.user);
|
||||
} catch {
|
||||
await router.push('/login');
|
||||
location.href = `${basePath}/login`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue