Browse Source

fix(nc-gui): use separate form state for password modal

pull/3669/head
braks 2 years ago committed by Raju Udava
parent
commit
b665dd6b05
  1. 2
      packages/nc-gui/composables/useSharedFormViewStore.ts
  2. 17
      packages/nc-gui/pages/[projectType]/form/[viewId].vue

2
packages/nc-gui/composables/useSharedFormViewStore.ts

@ -87,7 +87,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
} else if ((await extractSdkResponseErrorMsg(e)) === ErrorMessages.INVALID_SHARED_VIEW_PASSWORD) {
passwordDlg.value = true
if (password.value) passwordError.value = 'Something went wrong. Please check your credentials.'
if (password.value && password.value !== '') passwordError.value = 'Something went wrong. Please check your credentials.'
}
}
}

17
packages/nc-gui/pages/[projectType]/form/[viewId].vue

@ -7,11 +7,13 @@ import {
createEventHook,
definePageMeta,
provide,
reactive,
ref,
useProvideSharedFormStore,
useProvideSmartsheetStore,
useRoute,
useSidebar,
watch,
} from '#imports'
definePageMeta({
@ -36,6 +38,17 @@ if (!notFound.value) {
useProvideSmartsheetStore(sharedView, meta, true)
}
const form = reactive({
password: '',
})
watch(
() => form.password,
() => {
password.value = form.password
},
)
</script>
<template>
@ -56,9 +69,9 @@ if (!notFound.value) {
<!-- todo: i18n -->
<h2 class="text-xl font-semibold">This shared view is protected</h2>
<a-form ref="formRef" :model="{ password }" @finish="loadSharedView">
<a-form layout="vertical" no-style :model="form" @finish="loadSharedView">
<a-form-item name="password" :rules="[{ required: true, message: $t('msg.error.signUpRules.passwdRequired') }]">
<a-input-password v-model:value="password" :placeholder="$t('msg.info.signUp.enterPassword')" />
<a-input-password v-model:value="form.password" size="large" :placeholder="$t('msg.info.signUp.enterPassword')" />
</a-form-item>
<Transition name="layout">

Loading…
Cancel
Save