import { Box, Button, Divider, Group, Paper, PasswordInput, Stack, Text, TextInput } from '@mantine/core'; import { useForm, zodResolver } from '@mantine/form'; import { upperFirst } from '@mantine/hooks'; import { z } from 'zod'; import { login } from '../apis/auth'; import { useNavigate } from 'react-router'; import Links from '../system/links'; const loginSchema = z.object({ username: z.string().min(3, 'Username must be at least 3 characters'), password: z.string().min(6, 'Password must be at least 6 characters'), }); export default function Login() { const navigate = useNavigate(); const form = useForm({ validate: zodResolver(loginSchema), initialValues: { username: '', password: '', }, }); const handleSubmit = async (values: typeof form.values) => { const credential = await login(values); if (credential && credential.data) { navigate(Links.DASHBOARD); } }; return ( Login to Bid System
); }