mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-17 23:13:51 +01:00
21 lines
606 B
TypeScript
21 lines
606 B
TypeScript
import { useMutation } from '@tanstack/react-query';
|
|
import { invokeCmd } from '../lib/tauri';
|
|
import { useActiveEnvironment } from './useActiveEnvironment';
|
|
import { useCopy } from './useCopy';
|
|
|
|
export function useCopyAsCurl(requestId: string) {
|
|
const copy = useCopy();
|
|
const [environment] = useActiveEnvironment();
|
|
return useMutation({
|
|
mutationKey: ['copy_as_curl', requestId],
|
|
mutationFn: async () => {
|
|
const cmd: string = await invokeCmd('cmd_request_to_curl', {
|
|
requestId,
|
|
environmentId: environment?.id,
|
|
});
|
|
copy(cmd);
|
|
return cmd;
|
|
},
|
|
});
|
|
}
|