Browse Source

fix: custom url validation

Ramesh Mane 2 days ago
parent
commit
81da50e132
  1. 11
      packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue

11
packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue

@ -286,15 +286,14 @@ async function updateSharedView(custUrl = undefined) {
if (!activeView.value?.meta) return if (!activeView.value?.meta) return
const meta = activeView.value.meta const meta = activeView.value.meta
await $api.dbViewShare.update(activeView.value.id!, { const res = await $api.dbViewShare.update(activeView.value.id!, {
meta, meta,
password: activeView.value.password, password: activeView.value.password,
...(custUrl !== undefined ? { custom_url_path: custUrl ?? null } : {}), ...(custUrl !== undefined ? { custom_url_path: custUrl ?? null, original_url: sharedViewUrl(false) } : {}),
original_url: sharedViewUrl(false),
}) })
if (custUrl !== undefined) { if (custUrl !== undefined) {
activeView.value.custom_url_path = custUrl ?? null activeView.value.fk_custom_url_id = res.fk_custom_url_id
} }
} catch (e: any) { } catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e)) message.error(await extractSdkResponseErrorMsg(e))
@ -320,7 +319,7 @@ const dashboardBaseUrl = computed(() => {
const copyCustomUrl = async (custUrl = '') => { const copyCustomUrl = async (custUrl = '') => {
return await copy( return await copy(
`${dashboardBaseUrl.value}#/p/${encodeURIComponent(custUrl || activeView.value?.custom_url_path || '')}${ `${dashboardBaseUrl.value}#/p/${encodeURIComponent(custUrl)}${
preFillFormSearchParams.value && activeView.value?.type === ViewTypes.FORM ? `?${preFillFormSearchParams.value}` : '' preFillFormSearchParams.value && activeView.value?.type === ViewTypes.FORM ? `?${preFillFormSearchParams.value}` : ''
}`, }`,
) )
@ -349,7 +348,7 @@ const copyCustomUrl = async (custUrl = '') => {
<DlgShareAndCollaborateCustomUrl <DlgShareAndCollaborateCustomUrl
v-if="activeView" v-if="activeView"
v-model:view="activeView" :id="activeView.fk_custom_url_id"
:dashboard-url="dashboardBaseUrl" :dashboard-url="dashboardBaseUrl"
:copy-custom-url="copyCustomUrl" :copy-custom-url="copyCustomUrl"
@update-shared-view="updateSharedView" @update-shared-view="updateSharedView"

Loading…
Cancel
Save