|
|
@ -4,13 +4,17 @@ import Head from 'next/head'
|
|
|
|
import Router from 'next/router'
|
|
|
|
import Router from 'next/router'
|
|
|
|
import isEmail from 'validator/lib/isEmail'
|
|
|
|
import isEmail from 'validator/lib/isEmail'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import {useSetUser} from '~/hooks/useUser'
|
|
|
|
import {FormController, Input, Button} from '~/components/form'
|
|
|
|
import {FormController, Input, Button} from '~/components/form'
|
|
|
|
import useAccountRedirect from '~/hooks/useAccountRedirect'
|
|
|
|
import useAccountRedirect from '~/hooks/useAccountRedirect'
|
|
|
|
|
|
|
|
|
|
|
|
export default function Login(){
|
|
|
|
export default function Login(){
|
|
|
|
useAccountRedirect()
|
|
|
|
useAccountRedirect()
|
|
|
|
|
|
|
|
const setUser = useSetUser()
|
|
|
|
|
|
|
|
|
|
|
|
const redirectAfterLogin = user => {
|
|
|
|
const redirectAfterLogin = user => {
|
|
|
|
|
|
|
|
setUser(user)
|
|
|
|
|
|
|
|
|
|
|
|
if (user.is_admin)
|
|
|
|
if (user.is_admin)
|
|
|
|
Router.push('/admin')
|
|
|
|
Router.push('/admin')
|
|
|
|
else
|
|
|
|
else
|
|
|
|