Request pane context (#70)

This commit is contained in:
Gregory Schier
2024-09-03 06:18:25 -07:00
committed by GitHub
parent 0b9483954d
commit 942f959c36
6 changed files with 73 additions and 7 deletions

View File

@@ -0,0 +1,15 @@
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);
},
});
}