From d2767f9a9ea3a9076acd7736b45113c37c46fffb Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 7 Oct 2023 12:45:06 +0000 Subject: [PATCH] fix: shared view url correction --- .../dlg/share-and-collaborate/ShareBase.vue | 2 ++ .../dlg/share-and-collaborate/SharePage.vue | 12 +++++++++--- packages/nc-gui/middleware/auth.global.ts | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue b/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue index bfda193a9b..77deeeaa3f 100644 --- a/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue +++ b/packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue @@ -37,9 +37,11 @@ const workspaceStore = useWorkspace() const url = computed(() => { if (!sharedBase.value || !sharedBase.value.uuid) return '' + // get base url for workspace const baseUrl = getBaseUrl(workspaceStore.activeWorkspaceId) let dashboardUrl1 = dashboardUrl.value + if (baseUrl) { dashboardUrl1 = `${baseUrl}${appInfo.value?.dashboardPath}` } diff --git a/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue b/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue index 582b9072fb..3e52df977b 100644 --- a/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue +++ b/packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue @@ -165,9 +165,15 @@ function sharedViewUrl() { viewType = 'view' } - return encodeURI( - `${getBaseUrl(workspaceStore.activeWorkspaceId)}${appInfo.value?.dashboardPath}#/nc/${viewType}/${activeView.value.uuid}`, - ) + // get base url for workspace + const baseUrl = getBaseUrl(workspaceStore.activeWorkspaceId) + + let dashboardUrl1 = dashboardUrl.value + if (baseUrl) { + dashboardUrl1 = `${baseUrl}${appInfo.value?.dashboardPath}` + } + + return encodeURI(`${dashboardUrl1}#/nc/${viewType}/${activeView.value.uuid}`) } const toggleViewShare = async () => { diff --git a/packages/nc-gui/middleware/auth.global.ts b/packages/nc-gui/middleware/auth.global.ts index 993fdb3324..c128999bbf 100644 --- a/packages/nc-gui/middleware/auth.global.ts +++ b/packages/nc-gui/middleware/auth.global.ts @@ -1,6 +1,6 @@ import type { Api } from 'nocodb-sdk' import type { Actions } from '~/composables/useGlobal/types' -import { defineNuxtRouteMiddleware, extractSdkResponseErrorMsg, message, navigateTo, useApi, useGlobal, useRoles } from '#imports' +import { defineNuxtRouteMiddleware, message, navigateTo, useApi, useGlobal, useRoles } from '#imports' /** * Global auth middleware