Change text copy to use fallback (#811)

This commit is contained in:
Salih Altun
2024-09-11 20:01:45 +03:00
committed by GitHub
parent dddfaf98e2
commit 267c859d3b
5 changed files with 51 additions and 18 deletions

View File

@@ -26,6 +26,7 @@ import { taskIsFinalized } from "@/api/utils";
import fetchToCurl from "fetch-to-curl";
import { apiBaseUrl } from "@/util/env";
import { useApiCredential } from "@/hooks/useApiCredential";
import { copyText } from "@/util/copyText";
function createTaskRequestObject(values: TaskApiResponse) {
return {
@@ -142,12 +143,13 @@ function TaskDetails() {
"x-api-key": apiCredential ?? "<your-api-key>",
},
});
navigator.clipboard.writeText(curl);
toast({
variant: "success",
title: "Copied to Clipboard",
description:
"The cURL command has been copied to your clipboard.",
copyText(curl).then(() => {
toast({
variant: "success",
title: "Copied to Clipboard",
description:
"The cURL command has been copied to your clipboard.",
});
});
}}
>