Skip to content

Commit

Permalink
Merge pull request #166 from hotwax/108_create_user_error_message
Browse files Browse the repository at this point in the history
Improved: Displayed server side error message if there any, else displayed the generic message in toast while creating user (#108).
  • Loading branch information
ravilodhi authored Mar 12, 2024
2 parents 4fc98b2 + 2249302 commit 81df2b6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/views/CreateUser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,13 @@ export default defineComponent({
} else {
throw resp.data;
}
} catch (err) {
} catch (err:any) {
let errorMessage = translate('Failed to create user.');
if (err?.response?.data?.error?.message) {
errorMessage = err.response.data.error.message
}
console.error('error', err)
showToast(translate('Failed to create user.'))
showToast(errorMessage);
}
},
},
Expand Down

0 comments on commit 81df2b6

Please sign in to comment.