diff options
| -rw-r--r-- | src/components/Result/index.tsx | 6 | ||||
| -rw-r--r-- | src/helpers/fetchInfo.ts | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/components/Result/index.tsx b/src/components/Result/index.tsx index 706ddca..19f9386 100644 --- a/src/components/Result/index.tsx +++ b/src/components/Result/index.tsx @@ -63,14 +63,14 @@ function ShareButton({ guesses, variant }: ShareButtonProps) { const windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE']; const onWindows = windowsPlatforms.indexOf(window.navigator.platform) !== -1; - + const isSecureContext = window.isSecureContext; if (navigator.share !== undefined && !onWindows) { await navigator.share({ text: result }); - } else if (navigator.clipboard !== undefined) { + } else if (isSecureContext && navigator.clipboard !== undefined) { await navigator.clipboard.writeText(result); setButtonText('Copied!'); } else { - setButtonText('Failed to open share menu or copy'); + setButtonText('Clipboard unavailable (requires secure context)'); } }, [result]); diff --git a/src/helpers/fetchInfo.ts b/src/helpers/fetchInfo.ts index 248cd98..6da28aa 100644 --- a/src/helpers/fetchInfo.ts +++ b/src/helpers/fetchInfo.ts @@ -2,7 +2,7 @@ import { Info } from "../types/info"; export const fetchInfo = async (): Promise<Info> => { - const API_URL = process.env.REACT_APP_API_URL || "https://localhost:3000"; + const API_URL = process.env.REACT_APP_HEARDLE_API_URL || "https://localhost:3000"; const response = await fetch(`${API_URL}/info`); const data = await response.json(); return data as Info; |
