From 81316c4090e5e626fe4e377a818b3585d0b28eaf Mon Sep 17 00:00:00 2001 From: brianuribe6 Date: Mon, 22 Jan 2024 05:26:04 -0500 Subject: [PATCH] Fix URL not updating correctly on share dialog window --- apps/front-end/src/app/DialogCollab.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/front-end/src/app/DialogCollab.tsx b/apps/front-end/src/app/DialogCollab.tsx index 856c5dc..4b1496e 100644 --- a/apps/front-end/src/app/DialogCollab.tsx +++ b/apps/front-end/src/app/DialogCollab.tsx @@ -13,9 +13,11 @@ import { } from "../components/Dialog"; import { UserAddIcon } from "../components/Icons"; import { IS_BROWSER } from "@/utils"; +import { usePathname } from "next/navigation"; export default function DialogCollab() { - const fullUrl = getLocation(); + const pathname = usePathname(); + const fullUrl = `${getOrigin()}${pathname}`; const copyToClipBoard = () => { navigator.clipboard.writeText(fullUrl); @@ -45,6 +47,6 @@ export default function DialogCollab() { ); } -function getLocation() { - return IS_BROWSER ? window.location.href : ""; +function getOrigin() { + return IS_BROWSER ? window.location.origin : ""; }