Skip to content
Snippets Groups Projects
Commit a640dc9d authored by Caner's avatar Caner
Browse files

sign up fix

parent 6c59f1e2
No related branches found
No related tags found
1 merge request!22Start page
...@@ -4,13 +4,14 @@ import { Alert } from '@/components/ui/alert' ...@@ -4,13 +4,14 @@ import { Alert } from '@/components/ui/alert'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input' import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label' import { Label } from '@/components/ui/label'
import { signIn } from 'next-auth/react'
import { useState } from 'react' import { useState } from 'react'
import { useRouter } from 'next/navigation'
export const SignupForm = () => { export const SignupForm = () => {
const [email, setEmail] = useState('') const [email, setEmail] = useState('')
const [password, setPassword] = useState('') const [password, setPassword] = useState('')
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
const router = useRouter();
const onSubmit = async (e: React.FormEvent) => { const onSubmit = async (e: React.FormEvent) => {
e.preventDefault() e.preventDefault()
...@@ -27,7 +28,7 @@ export const SignupForm = () => { ...@@ -27,7 +28,7 @@ export const SignupForm = () => {
} }
}) })
if (res.ok) { if (res.ok) {
signIn() router.push("/login")
} else { } else {
setError((await res.json()).error) setError((await res.json()).error)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment