Files
yaak/src-web/hooks/useCopyHttpResponse.ts
Gregory Schier eb3d1c409b Merge pull request #256
* Update environment model to get ready for request/folder environments

* Folder environments in UI

* Folder environments working

* Tweaks and fixes

* Tweak environment encryption UX

* Tweak environment encryption UX

* Address comments

* Update fn name

* Add tsc back to lint rules

* Update src-web/components/EnvironmentEditor.tsx

* Merge remote-tracking branch 'origin/folder-environments' into folder…
2025-09-21 07:54:26 -07:00

15 lines
523 B
TypeScript

import type { HttpResponse } from '@yaakapp-internal/models';
import { copyToClipboard } from '../lib/copy';
import { getResponseBodyText } from '../lib/responseBody';
import { useFastMutation } from './useFastMutation';
export function useCopyHttpResponse(response: HttpResponse) {
return useFastMutation({
mutationKey: ['copy_http_response', response.id],
async mutationFn() {
const body = await getResponseBodyText({ responseId: response.id, filter: null });
copyToClipboard(body);
},
});
}