I was wondering what am I missing as it is unable to perform routing
const router = useRouter()
const [email,setEmail]=useState('')
const [name,setName] =useState('')
const [password,setPassword] =useState('')
const [confirmpassword,setConfirmPassword] =useState('')
const handleSubmit = (data:any)=>{
return(e:React.FormEvent)=>{
if(email && password && confirmpassword &&confirmpassword==password){
axios.post('/api/register',data)
.then(()=>{
toast.success("Successfully registered")
router.push("/home")
})
.catch((error)=>{
toast.error("Something went wrong")
})
}
else{
toast.error('Password does not match')
}
}
}