mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-07-03 03:21:46 +02:00
Improve response history menu (#492)
This commit is contained in:
@@ -3,10 +3,12 @@ import { copyToClipboard } from "../lib/copy";
|
||||
import { getResponseBodyText } from "../lib/responseBody";
|
||||
import { useFastMutation } from "./useFastMutation";
|
||||
|
||||
export function useCopyHttpResponse(response: HttpResponse) {
|
||||
export function useCopyHttpResponse(response: HttpResponse | null) {
|
||||
return useFastMutation({
|
||||
mutationKey: ["copy_http_response", response.id],
|
||||
mutationKey: ["copy_http_response", response?.id],
|
||||
async mutationFn() {
|
||||
if (response == null) return;
|
||||
|
||||
const body = await getResponseBodyText({ response, filter: null });
|
||||
copyToClipboard(body);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user