Changed error handling
This commit is contained in:
parent
c180b3c302
commit
f4186840fb
1 changed files with 3 additions and 3 deletions
|
|
@ -40,8 +40,8 @@ export default function ProfileSettingsPage(): JSX.Element {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await resetPassword(userData!.id, { password });
|
if(password !== "") await resetPassword(userData!.id, { password });
|
||||||
await updateUser(userData!.id, { profile_image: gradient });
|
if(gradient !== "") await updateUser(userData!.id, { profile_image: gradient });
|
||||||
if (gradient !== "") {
|
if (gradient !== "") {
|
||||||
let newUserData = cloneDeep(userData);
|
let newUserData = cloneDeep(userData);
|
||||||
newUserData!.profile_image = gradient;
|
newUserData!.profile_image = gradient;
|
||||||
|
|
@ -50,7 +50,7 @@ export default function ProfileSettingsPage(): JSX.Element {
|
||||||
}
|
}
|
||||||
setSuccessData({ title: "Changes saved successfully!" });
|
setSuccessData({ title: "Changes saved successfully!" });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setErrorData({ title: "Error saving changes", list: [error as string] });
|
setErrorData({ title: "Error saving changes", list: [(error as any).response.data.detail] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue