mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-27 02:58:34 +02:00
Start on plugin ctx API (#64)
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import { invokeCmd } from '../lib/tauri';
|
||||
import { useActiveEnvironmentId } from './useActiveEnvironmentId';
|
||||
import { useActiveEnvironment } from './useActiveEnvironment';
|
||||
import { useCopy } from './useCopy';
|
||||
|
||||
export function useCopyAsCurl(requestId: string) {
|
||||
const copy = useCopy();
|
||||
const environmentId = useActiveEnvironmentId();
|
||||
const [environment] = useActiveEnvironment();
|
||||
return useMutation({
|
||||
mutationKey: ['copy_as_curl', requestId],
|
||||
mutationFn: async () => {
|
||||
const cmd: string = await invokeCmd('cmd_request_to_curl', { requestId, environmentId });
|
||||
const cmd: string = await invokeCmd('cmd_request_to_curl', {
|
||||
requestId,
|
||||
environmentId: environment?.id,
|
||||
});
|
||||
copy(cmd);
|
||||
return cmd;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user