mirror of
https://github.com/strapi/strapi.git
synced 2025-07-23 17:10:08 +00:00
implement the deletion of tokens
This commit is contained in:
parent
b4ba83cd99
commit
cfe351fb43
@ -81,6 +81,27 @@ const ApiTokenListView = () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const deleteMutation = useMutation(
|
||||||
|
async id => {
|
||||||
|
await axiosInstance.delete(`/admin/api-tokens/${id}`);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
onSuccess: async () => {
|
||||||
|
await queryClient.invalidateQueries(['api-tokens']);
|
||||||
|
},
|
||||||
|
onError: err => {
|
||||||
|
if (err?.response?.data?.data) {
|
||||||
|
toggleNotification({ type: 'warning', message: err.response.data.data });
|
||||||
|
} else {
|
||||||
|
toggleNotification({
|
||||||
|
type: 'warning',
|
||||||
|
message: { id: 'notification.error', defaultMessage: 'An error occured' },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const shouldDisplayDynamicTable = canRead && apiTokens;
|
const shouldDisplayDynamicTable = canRead && apiTokens;
|
||||||
const shouldDisplayNoContent = canRead && !apiTokens && !canCreate;
|
const shouldDisplayNoContent = canRead && !apiTokens && !canCreate;
|
||||||
const shouldDisplayNoContentWithCreationButton = canRead && !apiTokens && canCreate;
|
const shouldDisplayNoContentWithCreationButton = canRead && !apiTokens && canCreate;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user