File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
apps/dashboard/src/app/login/onboarding Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { zodResolver } from "@hookform/resolvers/zod";
88import { useTrack } from "hooks/analytics/useTrack" ;
99import { useState } from "react" ;
1010import { useForm } from "react-hook-form" ;
11+ import { toast } from "sonner" ;
1112import {
1213 type AccountValidationSchema ,
1314 accountValidationSchema ,
@@ -81,15 +82,21 @@ export const AccountForm: React.FC<AccountFormProps> = ({
8182 data,
8283 } ) ;
8384 } ,
84- onError : ( err ) => {
85- const error = err as Error ;
85+ onError : ( error ) => {
86+ console . error ( error ) ;
8687
8788 if (
8889 onDuplicateError &&
8990 error ?. message . match ( / e m a i l a d d r e s s a l r e a d y e x i s t s / )
9091 ) {
9192 onDuplicateError ( values . email ) ;
93+ return ;
94+ } else if ( error . message . includes ( "INVALID_EMAIL_ADDRESS" ) ) {
95+ toast . error ( "Invalid Email Address" ) ;
96+ } else {
97+ toast . error ( error . message || "Failed to update account" ) ;
9298 }
99+
93100 trackEvent ( {
94101 category : "account" ,
95102 action : "update" ,
You can’t perform that action at this time.
0 commit comments