Merge pull request #102 from niteshiftdev/kc/umami

fix login
This commit is contained in:
KC Beard 2025-11-26 00:18:32 -05:00 committed by GitHub
commit f4d0a65b16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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');
},
});