From f4186840fbfda1858a2481dfaab140d083604abe Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Fri, 8 Sep 2023 17:07:27 -0300 Subject: [PATCH] Changed error handling --- src/frontend/src/pages/ProfileSettingsPage/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/pages/ProfileSettingsPage/index.tsx b/src/frontend/src/pages/ProfileSettingsPage/index.tsx index 3f89dfa7f..fc12d2fb3 100644 --- a/src/frontend/src/pages/ProfileSettingsPage/index.tsx +++ b/src/frontend/src/pages/ProfileSettingsPage/index.tsx @@ -40,8 +40,8 @@ export default function ProfileSettingsPage(): JSX.Element { return; } try { - await resetPassword(userData!.id, { password }); - await updateUser(userData!.id, { profile_image: gradient }); + if(password !== "") await resetPassword(userData!.id, { password }); + if(gradient !== "") await updateUser(userData!.id, { profile_image: gradient }); if (gradient !== "") { let newUserData = cloneDeep(userData); newUserData!.profile_image = gradient; @@ -50,7 +50,7 @@ export default function ProfileSettingsPage(): JSX.Element { } setSuccessData({ title: "Changes saved successfully!" }); } catch (error) { - setErrorData({ title: "Error saving changes", list: [error as string] }); + setErrorData({ title: "Error saving changes", list: [(error as any).response.data.detail] }); } }