fix(userStore): simplify error handling on save

Replace complex error parsing with direct error message display.
This improves code maintainability while still providing useful
feedback to users when saving their account data fails.
This commit is contained in:
Shekar Siri 2025-03-24 17:14:02 +01:00
parent eba22e0efa
commit 300a857a5c

View file

@ -240,18 +240,7 @@ class UserStore {
resolve(response);
})
.catch(async (e) => {
const err = await e.response?.json();
runInAction(() => {
this.saving = false;
});
const errStr = err.errors[0]
? err.errors[0].includes('already exists')
? this.t(
"This email is already linked to an account or team on OpenReplay and can't be used again.",
)
: err.errors[0]
: this.t('Error saving user');
toast.error(errStr);
toast.error(e.message || this.t("Failed to save user's data."));
reject(e);
})
.finally(() => {