Skip to content

Commit

Permalink
fix: errorMessage destructring error
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavan Soratur authored and Pavan Soratur committed Oct 19, 2024
1 parent a8fbcb5 commit 5c2f68e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/auth/LoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export const LoginForm: React.FC<LoginFormProps> = ({ onSubmitAction }) => {

const onSubmit = async (data: LoginFormData) => {
startTransition(async () => {
const { errorMessage } = await onSubmitAction(data);
const { errorMessage = 'Something went wrong!' } =
await onSubmitAction(data);

if (errorMessage) toast.error(errorMessage);

Expand Down
5 changes: 4 additions & 1 deletion components/auth/RegisterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export const RegisterForm: React.FC<RegisterFormProps> = ({

const onSubmit = async (data: RegisterFormData) => {
startTransition(async () => {
const { successMessage, errorMessage } = await onSubmitAction(data);
const {
successMessage = 'Successfully registered!',
errorMessage = 'Something went wrong!',
} = await onSubmitAction(data);

if (successMessage) toast.success(successMessage);
if (errorMessage) toast.error(errorMessage);
Expand Down

0 comments on commit 5c2f68e

Please sign in to comment.