diff --git a/packages/apps/esm-login-app/src/change-password/change-password.component.tsx b/packages/apps/esm-login-app/src/change-password/change-password.component.tsx index 64f3864a1..6a93ce5c5 100644 --- a/packages/apps/esm-login-app/src/change-password/change-password.component.tsx +++ b/packages/apps/esm-login-app/src/change-password/change-password.component.tsx @@ -44,29 +44,32 @@ const ChangePassword: React.FC = () => { resolver: zodResolver(changePasswordFormSchema), }); - const onSubmit: SubmitHandler> = useCallback((data) => { - setIsChangingPassword(true); + const onSubmit: SubmitHandler> = useCallback( + (data) => { + setIsChangingPassword(true); - const { oldPassword, newPassword } = data; + const { oldPassword, newPassword } = data; - changeUserPassword(oldPassword, newPassword) - .then(() => { - showSnackbar({ - title: t('passwordChangedSuccessfully', 'Password changed successfully'), - kind: 'success', + changeUserPassword(oldPassword, newPassword) + .then(() => { + showSnackbar({ + title: t('passwordChangedSuccessfully', 'Password changed successfully'), + kind: 'success', + }); + }) + .catch((error) => { + showSnackbar({ + kind: 'error', + subtitle: error?.message, + title: t('errorChangingPassword', 'Error changing password'), + }); + }) + .finally(() => { + setIsChangingPassword(false); }); - }) - .catch((error) => { - showSnackbar({ - kind: 'error', - subtitle: error?.message, - title: t('errorChangingPassword', 'Error changing password'), - }); - }) - .finally(() => { - setIsChangingPassword(false); - }); - }, []); + }, + [t], + ); const onError = useCallback(() => setIsChangingPassword(false), []); @@ -121,7 +124,7 @@ const ChangePassword: React.FC = () => { />