mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-23 02:54:58 +01:00
Placeholder CM tags working
This commit is contained in:
15
src-web/components/useCopyHttpResponse.ts
Normal file
15
src-web/components/useCopyHttpResponse.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useMutation } from '@tanstack/react-query';
|
||||
import type { HttpResponse } from '@yaakapp/api';
|
||||
import { useCopy } from '../hooks/useCopy';
|
||||
import { getResponseBodyText } from '../lib/responseBody';
|
||||
|
||||
export function useCopyHttpResponse(response: HttpResponse) {
|
||||
const copy = useCopy();
|
||||
return useMutation({
|
||||
mutationKey: ['copy_http_response'],
|
||||
async mutationFn() {
|
||||
const body = await getResponseBodyText(response);
|
||||
copy(body);
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user