@@ -17,7 +17,7 @@ export const SignUpForm = ({
1717 ...props
1818} : React . ComponentPropsWithoutRef < 'form' > ) => {
1919 const router = useRouter ( )
20- const t = useTranslations ( )
20+ const t = useTranslations ( 'Login' )
2121
2222 const [ isLoading , setIsLoading ] = useState < boolean > ( false )
2323
@@ -60,7 +60,7 @@ export const SignUpForm = ({
6060 try {
6161 const parsedCredentials = zHandle ( )
6262 if ( ! parsedCredentials . success ) {
63- toast . error ( t ( 'Login. invalidCredentials' , { defaultValue : 'Please check your email and password format' } ) )
63+ toast . error ( t ( 'invalidCredentials' ) )
6464 return
6565 }
6666
@@ -76,10 +76,10 @@ export const SignUpForm = ({
7676 //show loading
7777 console . log ( ctx )
7878 } ,
79- onSuccess : ( ctx ) => {
80- toast . success ( t ( 'Login. signUpSuccess' , { defaultValue : 'Sign up successful' } ) )
79+ onSuccess : ( ) => {
80+ toast . success ( t ( 'signUpSuccess' ) )
8181 setTimeout ( ( ) => {
82- location . replace ( '/admin' )
82+ router . replace ( '/admin' )
8383 } , 1000 )
8484 } ,
8585 onError : ( ctx ) => {
@@ -89,7 +89,7 @@ export const SignUpForm = ({
8989
9090 } catch ( e ) {
9191 console . error ( e )
92- toast . error ( t ( 'Login. error' , { defaultValue : 'An error occurred, please try again' } ) )
92+ toast . error ( t ( 'error' ) )
9393 } finally {
9494 setIsLoading ( false )
9595 }
@@ -103,7 +103,7 @@ export const SignUpForm = ({
103103 return (
104104 < form onSubmit = { handleSubmit } className = { cn ( 'space-y-4' , className ) } { ...props } >
105105 < div className = "space-y-2" >
106- < Label htmlFor = "email" className = "select-none" > { t ( 'Login. email' ) } </ Label >
106+ < Label htmlFor = "email" className = "select-none" > { t ( 'email' ) } </ Label >
107107 < Input
108108 id = "email"
109109 type = "email"
@@ -116,7 +116,7 @@ export const SignUpForm = ({
116116 />
117117 </ div >
118118 < div className = "space-y-2" >
119- < Label htmlFor = "password" className = "select-none" > { t ( 'Login. password' ) } </ Label >
119+ < Label htmlFor = "password" className = "select-none" > { t ( 'password' ) } </ Label >
120120 < Input
121121 id = "password"
122122 type = "password"
@@ -132,17 +132,17 @@ export const SignUpForm = ({
132132 type = "submit"
133133 className = "w-full h-12 select-none cursor-pointer"
134134 disabled = { email . length === 0 || password . length < 8 }
135- aria-label = { t ( 'Login. signUp' ) }
135+ aria-label = { t ( 'signUp' ) }
136136 >
137- { isLoading && < ReloadIcon className = "mr-2 h-4 w-4 animate-spin" /> } { t ( 'Login. signUp' ) }
137+ { isLoading && < ReloadIcon className = "mr-2 h-4 w-4 animate-spin" /> } { t ( 'signUp' ) }
138138 </ Button >
139139 < Button
140140 variant = "ghost"
141141 className = "w-full select-none cursor-pointer"
142142 onClick = { ( ) => router . push ( '/' ) }
143- aria-label = { t ( 'Login. goHome' ) }
143+ aria-label = { t ( 'goHome' ) }
144144 >
145- { t ( 'Login. goHome' ) }
145+ { t ( 'goHome' ) }
146146 </ Button >
147147 </ form >
148148 )
0 commit comments