mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-21 08:11:24 +02:00
Backspace to delete selected in sidebar
This commit is contained in:
18
src-web/hooks/useDeleteAnyRequest.tsx
Normal file
18
src-web/hooks/useDeleteAnyRequest.tsx
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useDeleteAnyGrpcRequest } from './useDeleteAnyGrpcRequest';
|
||||
import { useDeleteAnyHttpRequest } from './useDeleteAnyHttpRequest';
|
||||
import { useFastMutation } from './useFastMutation';
|
||||
|
||||
export function useDeleteAnyRequest() {
|
||||
const deleteAnyHttpRequest = useDeleteAnyHttpRequest();
|
||||
const deleteAnyGrpcRequest = useDeleteAnyGrpcRequest();
|
||||
|
||||
return useFastMutation<void, string, string>({
|
||||
mutationKey: ['delete_request'],
|
||||
mutationFn: async (id) => {
|
||||
if (id == null) return;
|
||||
// We don't know what type it is based on the ID, so just try deleting both
|
||||
deleteAnyHttpRequest.mutate(id);
|
||||
deleteAnyGrpcRequest.mutate(id);
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user