Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/components/molecules/RegisterForm/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useState } from "react"
import { Container } from "@medusajs/ui"
import Link from "next/link"
import { PasswordValidator } from "@/components/cells/PasswordValidator/PasswordValidator"
import { toast } from "@/lib/helpers/toast"

export const RegisterForm = () => {
const methods = useForm<RegisterFormData>({
Expand Down Expand Up @@ -43,8 +44,7 @@ const Form = () => {
"8chars": false,
symbolOrDigit: false,
})
const [error, setError] = useState()
const {
const {
handleSubmit,
register,
watch,
Expand All @@ -61,7 +61,9 @@ const Form = () => {

const res = passwordError.isValid && (await signup(formData))

if (res && !res?.id) setError(res)
if (res && !res?.id) {
toast.error({ title: res})
}
}

return (
Expand Down Expand Up @@ -118,7 +120,6 @@ const Form = () => {
/>
</div>

{error && <p className="label-md text-negative">{error}</p>}
<Button
className="w-full flex justify-center mt-8 uppercase"
disabled={isSubmitting}
Expand Down