mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-31 14:33:18 +02:00
Websocket Support (#159)
This commit is contained in:
31
src-web/commands/deleteWebsocketRequest.tsx
Normal file
31
src-web/commands/deleteWebsocketRequest.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import type {WebsocketRequest} from "@yaakapp-internal/models";
|
||||
import { deleteWebsocketRequest as cmdDeleteWebsocketRequest } from '@yaakapp-internal/ws';
|
||||
import { InlineCode } from '../components/core/InlineCode';
|
||||
import { createFastMutation } from '../hooks/useFastMutation';
|
||||
import { trackEvent } from '../lib/analytics';
|
||||
import { showConfirm } from '../lib/confirm';
|
||||
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
||||
|
||||
export const deleteWebsocketRequest = createFastMutation({
|
||||
mutationKey: ['delete_websocket_request'],
|
||||
mutationFn: async (request: WebsocketRequest) => {
|
||||
const confirmed = await showConfirm({
|
||||
id: 'delete-websocket-request',
|
||||
title: 'Delete WebSocket Request',
|
||||
variant: 'delete',
|
||||
description: (
|
||||
<>
|
||||
Permanently delete <InlineCode>{fallbackRequestName(request)}</InlineCode>?
|
||||
</>
|
||||
),
|
||||
});
|
||||
if (!confirmed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return cmdDeleteWebsocketRequest(request.id);
|
||||
},
|
||||
onSuccess: async () => {
|
||||
trackEvent('websocket_request', 'delete');
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user