Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat: remove query params and set proper path
Marc Seitz1189b4bcae2d
diff --git a/components/view/DataroomViewer.tsx b/components/view/DataroomViewer.tsxindex 0e65de99..c3db6607 100644--- a/components/view/DataroomViewer.tsx+++ b/components/view/DataroomViewer.tsx@@ -107,10 +107,14 @@ export default function DataroomViewer({setDataroomVerified(true);delete currentQuery.token;delete currentQuery.email;+ delete currentQuery.domain;+ delete currentQuery.slug;++ const currentPath = router.asPath.split("?")[0];router.replace({- pathname: router.pathname,+ pathname: currentPath,query: currentQuery,},undefined,diff --git a/components/view/PagesViewerNew.tsx b/components/view/PagesViewerNew.tsxindex eca923dc..66e2d25a 100644--- a/components/view/PagesViewerNew.tsx+++ b/components/view/PagesViewerNew.tsx@@ -320,11 +320,12 @@ export default function PagesViewer({// Remove token and email query parameters on component mountconst removeQueryParams = (queries: string[]) => {const currentQuery = { ...router.query };+ const currentPath = router.asPath.split("?")[0];queries.map((query) => delete currentQuery[query]);router.replace({- pathname: router.pathname,+ pathname: currentPath,query: currentQuery,},undefined,@@ -333,7 +334,7 @@ export default function PagesViewer({};if (!dataroomId && router.query.token) {- removeQueryParams(["token", "email"]);+ removeQueryParams(["token", "email", "domain", "slug"]);}}, []); // Run once on mountdiff --git a/components/view/dataroom/dataroom-view.tsx b/components/view/dataroom/dataroom-view.tsxindex ee2b967c..12383ae5 100644--- a/components/view/dataroom/dataroom-view.tsx+++ b/components/view/dataroom/dataroom-view.tsx@@ -212,10 +212,14 @@ export default function DataroomView({const currentQuery = { ...router.query };delete currentQuery.token;delete currentQuery.email;+ delete currentQuery.domain;+ delete currentQuery.slug;++ const currentPath = router.asPath.split("?")[0];router.replace({- pathname: router.pathname,+ pathname: currentPath,query: currentQuery,},undefined,diff --git a/components/view/document-view.tsx b/components/view/document-view.tsxindex 07952a91..e936fc95 100644--- a/components/view/document-view.tsx+++ b/components/view/document-view.tsx@@ -173,10 +173,14 @@ export default function DocumentView({const currentQuery = { ...router.query };delete currentQuery.token;delete currentQuery.email;+ delete currentQuery.domain;+ delete currentQuery.slug;++ const currentPath = router.asPath.split("?")[0];router.replace({- pathname: router.pathname,+ pathname: currentPath,query: currentQuery,},undefined,diff --git a/components/view/viewer/image-viewer.tsx b/components/view/viewer/image-viewer.tsxindex bac2bbe5..a26fd90f 100644--- a/components/view/viewer/image-viewer.tsx+++ b/components/view/viewer/image-viewer.tsx@@ -215,11 +215,12 @@ export default function ImageViewer({// Remove token and email query parameters on component mountconst removeQueryParams = (queries: string[]) => {const currentQuery = { ...router.query };+ const currentPath = router.asPath.split("?")[0];queries.map((query) => delete currentQuery[query]);router.replace({- pathname: router.pathname,+ pathname: currentPath,query: currentQuery,},undefined,@@ -228,7 +229,7 @@ export default function ImageViewer({};if (!dataroomId && router.query.token) {- removeQueryParams(["token", "email"]);+ removeQueryParams(["token", "email", "domain", "slug"]);}}, []); // Run once on mount