import React from 'react' import Link from 'next/link' import Router from 'next/router' import isEmail from 'validator/lib/isEmail' import axios from 'axios' import {FormController, Input, Button} from '~/components/form' import useErrorReducer from '../hooks/errorReducer' export default function Login(){ const [errors, dispatch] = useErrorReducer() const submit = async (values)=>{ try { await axios.post(`/api/auth`, values) Router.push('/') } catch (err) { if(!err.response || err.response.status !== 422) throw err; dispatch({ type: 'set_errors', errors: err.response.data.errors }) } } return (

Login

isEmail(value)} hint="Enter a valid email address" /> (value.length >= 8)} hint="Password must be at least 8 characters long" />

Need an account? Register here.

) }