diff options
| author | Yuval Adam <_@yuv.al> | 2024-09-21 22:15:47 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2024-09-21 22:15:47 +0200 |
| commit | 9ad33e622bd80662491502b49c0b82178c66ed98 (patch) | |
| tree | fee6cd3bb4703d143ad46427e2e69bef32d2f7d2 | |
| parent | e062ddcb6e73c9431a748cd5818ad747a2cb2416 (diff) | |
Fix handleShare()
| -rw-r--r-- | app/page.tsx | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/app/page.tsx b/app/page.tsx index 3db9924..843f6ba 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -65,15 +65,11 @@ export default function Cidr() { } const handleShare = async () => { - try { - let frag = "#" + ip.join(".") + "/" + cidr; - window.location.hash = frag; - await navigator.clipboard.writeText("foo"); - setIsShared(true); - setTimeout(() => setIsShared(false), 2000); - } catch (err) { - console.error('Failed to share CIDR link: ', err); - } + const frag = "#" + ip.join(".") + "/" + cidr; + window.location.hash = frag; + await navigator.clipboard.writeText(window.location.toString()); + setIsShared(true); + setTimeout(() => setIsShared(false), 2000); }; useEffect(() => { |
