mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-15 21:53:36 +01:00
16 lines
482 B
TypeScript
16 lines
482 B
TypeScript
import { useFastMutation } from './useFastMutation';
|
|
import type { HttpResponse } from '@yaakapp-internal/models';
|
|
import { useCopy } from './useCopy';
|
|
import { getResponseBodyText } from '../lib/responseBody';
|
|
|
|
export function useCopyHttpResponse(response: HttpResponse) {
|
|
const copy = useCopy();
|
|
return useFastMutation({
|
|
mutationKey: ['copy_http_response'],
|
|
async mutationFn() {
|
|
const body = await getResponseBodyText(response);
|
|
copy(body);
|
|
},
|
|
});
|
|
}
|