import { useMutation } from '@tanstack/react-query'; import { Form, FormInput, FormButtons, TextField, PasswordField, SubmitButton, Icon, } from 'react-basics'; import { useRouter } from 'next/router'; import { useApi } from 'next-basics'; import { setUser } from 'store/app'; import { setAuthToken } from 'lib/client'; import Logo from 'assets/logo.svg'; import styles from './Form.module.css'; export default function LoginForm() { const router = useRouter(); const { post } = useApi(); const { mutate, error, isLoading } = useMutation(data => post('/auth/login', data)); const handleSubmit = async data => { mutate(data, { onSuccess: async ({ token, user }) => { setAuthToken(token); setUser(user); await router.push('/websites'); }, }); }; return ( <>
umami