Browse Source

fix: share view logic

pull/3515/head
Wing-Kam Wong 2 years ago
parent
commit
0291ae44c0
  1. 20
      packages/nc-gui/components/smartsheet-toolbar/ShareView.vue

20
packages/nc-gui/components/smartsheet-toolbar/ShareView.vue

@ -23,7 +23,7 @@ const { isSharedBase } = useProject()
let showShareModel = $ref(false)
let passwordProtected = $ref(false)
const passwordProtected = ref(false)
const shared = ref()
@ -40,11 +40,9 @@ const allowCSVDownload = computed({
const genShareLink = async () => {
shared.value = await $api.dbViewShare.create(view.value.id as string)
// shared.meta = shared.meta && typeof shared.meta === 'string' ? JSON.parse(shared.meta) : shared.meta;
// // todo: url
// shareLink = shared;
// passwordProtect = shared.password !== null;
// allowCSVDownload = shared.meta.allowCSVDownload;
shared.value.meta =
shared.value.meta && typeof shared.value.meta === 'string' ? JSON.parse(shared.value.meta) : shared.value.meta
passwordProtected.value = shared.value.password !== null && shared.value.password !== ''
showShareModel = true
}
@ -69,7 +67,6 @@ const sharedViewUrl = computed(() => {
async function saveAllowCSVDownload() {
try {
const meta = shared.value.meta && typeof shared.value.meta === 'string' ? JSON.parse(shared.value.meta) : shared.value.meta
await $api.dbViewShare.update(shared.value.id, {
meta,
} as any)
@ -105,18 +102,11 @@ const copyLink = () => {
message.success(t('msg.info.copiedToClipboard'))
}
watch(
() => passwordProtected,
(value) => {
watch(passwordProtected, (value) => {
if (!value) {
shared.value.password = ''
saveShareLinkPassword()
}
},
)
onMounted(() => {
if (shared.value?.password?.length) passwordProtected = true
})
</script>

Loading…
Cancel
Save