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:
parent
eba22e0efa
commit
300a857a5c
1 changed files with 1 additions and 12 deletions
|
|
@ -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(() => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue