mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
commit
f4d0a65b16
1 changed files with 5 additions and 0 deletions
|
|
@ -9,6 +9,7 @@ import {
|
|||
Column,
|
||||
Heading,
|
||||
} from '@umami/react-zen';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useMessages, useUpdateQuery } from '@/components/hooks';
|
||||
import { setUser } from '@/store/app';
|
||||
|
|
@ -18,6 +19,7 @@ import { Logo } from '@/components/svg';
|
|||
export function LoginForm() {
|
||||
const { formatMessage, labels, getErrorMessage } = useMessages();
|
||||
const router = useRouter();
|
||||
const queryClient = useQueryClient();
|
||||
const { mutateAsync, error } = useUpdateQuery('/auth/login');
|
||||
|
||||
const handleSubmit = async (data: any) => {
|
||||
|
|
@ -26,6 +28,9 @@ export function LoginForm() {
|
|||
setClientAuthToken(token);
|
||||
setUser(user);
|
||||
|
||||
// Seed React Query cache to prevent race condition
|
||||
queryClient.setQueryData(['login'], user);
|
||||
|
||||
router.push('/websites');
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue