import React from 'react' import Link from 'next/link' import Router from 'next/router' import axios from 'axios' import Head from 'next/head' import {useSetUser} from '~/hooks/useUser' import {FormController, Input, Button} from '~/components/form' import useAccountRedirect from '~/hooks/useAccountRedirect' ResetPassword.getInitialProps = async ({ctx}) => { const {id, key} = ctx.query return { link_uuid: id, link_key: key } } export default function ResetPassword({link_uuid, link_key}){ useAccountRedirect() const setUser = useSetUser() async function submitReset({password, password2}) { const {data: user} = await axios.post(`/api/users/recover/password`, { password, password2, link_uuid, link_key, }) setUser(user) if (user.is_admin) Router.push('/admin') else Router.push('/account') } return ( <> Reset Password | Society of Socks

Reset Password

(value.length >= 8)} hint="Password must be at least 8 characters long" /> (value === fields.password.value)} hint="Passwords must match" />
) }