mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-21 17:09:37 +01:00
Copy as curl
This commit is contained in:
13
src-web/hooks/useCopyAsCurl.ts
Normal file
13
src-web/hooks/useCopyAsCurl.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
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;
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user