mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 01:18:42 +00:00
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:
parent
eec835a07a
commit
cba01cd052
3 changed files with 4 additions and 7 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue