feat(firewall): rename revoke function to delete and update related UI components

Refactored the revoke functionality for firewall clients to be more accurately represented as a delete operation. Updated the corresponding API call to use the DELETE method and modified the UI components to reflect this change, including confirmation dialogs and success messages. Adjusted tests to ensure the new delete functionality works as intended.
This commit is contained in:
Denozordec
2026-07-09 00:27:50 +07:00
parent e51999c908
commit 4a4c11c6bf
3 changed files with 40 additions and 34 deletions
+4 -4
View File
@@ -60,16 +60,16 @@ export function useApproveFirewallClient() {
})
}
export function useRevokeFirewallClient() {
export function useDeleteFirewallClient() {
const qc = useQueryClient()
return useMutation({
mutationFn: (id: string) =>
apiJSON<{ status: string }>(`/v1/firewall/clients/${id}/revoke`, { method: 'POST' }),
apiJSON<void>(`/v1/firewall/clients/${id}`, { method: 'DELETE' }),
onSuccess: () => {
toast.success('Клиент отключён')
toast.success('Клиент удалён')
void qc.invalidateQueries({ queryKey: firewallKeys.clients() })
},
onError: (e) => toast.error(e instanceof Error ? e.message : 'Не удалось отклонить'),
onError: (e) => toast.error(e instanceof Error ? e.message : 'Не удалось удалить'),
})
}