mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-14 21:23:40 +01:00
16 lines
466 B
TypeScript
16 lines
466 B
TypeScript
import { useMutation } from '@tanstack/react-query';
|
|
import type { HttpResponse } from '@yaakapp/api';
|
|
import { useCopy } from './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);
|
|
},
|
|
});
|
|
}
|