-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Forgot/ResetPassword #6
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
libs/ui/src/components/ForgotPasswordForm/ForgotPasswordForm.stories.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I left a small comments about form fields type definition and removing commented out lines.
}); | ||
|
||
export type ForgotPasswordFormProps = { | ||
onSubmitHandler: (data: FieldValues) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can declare ResetPasswordFieldValues
to be used instead of FieldValues
, so that we will able to see the field value types in the pages/components where we call onSubmit handler.
For example Strapi expect id as number but we might get the id as string from some forms. Type checking will guide us about type conversions in this case.
export type ResetPasswordFieldValues = {
password: string;
passwordConfirmation: string;
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this part was like you said normally, but since there were type errors in the errors
and register
props in the FormItem
, I had to do it this way.
export type ResetPasswordFieldValues = {
password: string;
passwordConfirmation: string;
};
const {
register,
handleSubmit,
formState: { errors },
} = useForm<ResetPasswordFieldValues>();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zahirekrem09 Well, it makes sense then.
You can. maybe fix the lint issues and then merge it.
yarn lint
or npx nx affected --target=lint --fix
No description provided.