Handle invalid delete requests (#699)

* Handle delete responses like other responses

* Render error flash if an invite can't be deleted
This commit is contained in:
Mike Stone 2016-12-29 14:04:03 -05:00 committed by Mike Arpaia
parent eec835a07a
commit cba01cd052
3 changed files with 4 additions and 7 deletions

View file

@ -20,7 +20,7 @@ class Base {
static _request (method, endpoint, body, overrideHeaders) {
const credentials = 'same-origin';
const { DELETE, GET } = REQUEST_METHODS;
const { GET } = REQUEST_METHODS;
const headers = {
Accept: 'application/json',
'Content-Type': 'application/json',
@ -32,8 +32,6 @@ class Base {
return fetch(endpoint, requestAttrs)
.then((response) => {
if (method === DELETE) return false;
return response.json()
.then((jsonResponse) => {
if (response.ok) {

View file

@ -85,9 +85,8 @@ class UserManagementPage extends Component {
});
case 'revert_invitation':
return dispatch(inviteActions.destroy(user))
.then(() => {
return dispatch(renderFlash('success', 'Invite revoked'));
});
.then(() => dispatch(renderFlash('success', 'Invite revoked')))
.catch(() => dispatch(renderFlash('error', 'Invite could not be revoked')));
default:
return false;
}

View file

@ -265,7 +265,7 @@ export const validRevokeInviteRequest = (bearerToken, inviteID) => {
},
})
.delete(`/api/v1/kolide/invites/${inviteID}`)
.reply(200);
.reply(200, {});
};
export const invalidResetPasswordRequest = (password, token, error) => {