mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-24 19:44:53 +01:00
14 lines
418 B
TypeScript
14 lines
418 B
TypeScript
import { useMutation } from '@tanstack/react-query';
|
|
import { invoke } from '@tauri-apps/api/core';
|
|
import { writeText } from '@tauri-apps/plugin-clipboard-manager';
|
|
|
|
export function useCopyAsCurl(requestId: string) {
|
|
return useMutation<string>({
|
|
mutationFn: async () => {
|
|
const cmd: string = await invoke('cmd_request_to_curl', { requestId });
|
|
await writeText(cmd);
|
|
return cmd;
|
|
},
|
|
});
|
|
}
|