mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-28 21:49:40 +02:00
chore: biome checks
This commit is contained in:
parent
c97887a63d
commit
481ec5533b
1 changed files with 8 additions and 8 deletions
|
|
@ -36,25 +36,25 @@ export function useApiKey(): UseApiKeyReturn {
|
||||||
const fallbackCopyTextToClipboard = (text: string) => {
|
const fallbackCopyTextToClipboard = (text: string) => {
|
||||||
const textArea = document.createElement("textarea");
|
const textArea = document.createElement("textarea");
|
||||||
textArea.value = text;
|
textArea.value = text;
|
||||||
|
|
||||||
// Avoid scrolling to bottom
|
// Avoid scrolling to bottom
|
||||||
textArea.style.top = "0";
|
textArea.style.top = "0";
|
||||||
textArea.style.left = "0";
|
textArea.style.left = "0";
|
||||||
textArea.style.position = "fixed";
|
textArea.style.position = "fixed";
|
||||||
textArea.style.opacity = "0";
|
textArea.style.opacity = "0";
|
||||||
|
|
||||||
document.body.appendChild(textArea);
|
document.body.appendChild(textArea);
|
||||||
textArea.focus();
|
textArea.focus();
|
||||||
textArea.select();
|
textArea.select();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const successful = document.execCommand('copy');
|
const successful = document.execCommand("copy");
|
||||||
document.body.removeChild(textArea);
|
document.body.removeChild(textArea);
|
||||||
|
|
||||||
if (successful) {
|
if (successful) {
|
||||||
setCopied(true);
|
setCopied(true);
|
||||||
toast.success("API key copied to clipboard");
|
toast.success("API key copied to clipboard");
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setCopied(false);
|
setCopied(false);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
@ -77,7 +77,7 @@ export function useApiKey(): UseApiKeyReturn {
|
||||||
await navigator.clipboard.writeText(apiKey);
|
await navigator.clipboard.writeText(apiKey);
|
||||||
setCopied(true);
|
setCopied(true);
|
||||||
toast.success("API key copied to clipboard");
|
toast.success("API key copied to clipboard");
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setCopied(false);
|
setCopied(false);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
|
@ -97,4 +97,4 @@ export function useApiKey(): UseApiKeyReturn {
|
||||||
copied,
|
copied,
|
||||||
copyToClipboard,
|
copyToClipboard,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue