Skip to content

Commit

Permalink
Show bad request message in ui
Browse files Browse the repository at this point in the history
When a username already exists the api returns 400, this should be shown
to the user.
  • Loading branch information
jmattheis committed Apr 3, 2018
1 parent b2e2417 commit eafb428
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ui/src/actions/defaultAxios.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,16 @@ axios.interceptors.response.use(undefined, (error) => {
return Promise.reject(error);
}

if (error.response.status === 401) {
const status = error.response.status;

if (status === 401) {
tryAuthenticate().then(() => snack('Could not complete request.'));
}

if (status === 400) {
snack(error.response.data.error + ': ' + error.response.data.errorDescription);
}

return Promise.reject(error);
});

Expand Down

0 comments on commit eafb428

Please sign in to comment.