mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
2 years ago
|
<script setup lang="ts">
|
||
2 years ago
|
import { message } from 'ant-design-vue'
|
||
2 years ago
|
import { extractSdkResponseErrorMsg } from '~/utils'
|
||
2 years ago
|
|
||
2 years ago
|
interface Props {
|
||
|
modelValue: boolean
|
||
|
}
|
||
2 years ago
|
const props = defineProps<Props>()
|
||
|
const emit = defineEmits(['update:modelValue'])
|
||
2 years ago
|
|
||
|
const route = useRoute()
|
||
|
const { loadSharedView } = useSharedView()
|
||
|
|
||
|
const formState = ref({ password: undefined })
|
||
|
const vModel = useVModel(props, 'modelValue', emit)
|
||
|
|
||
|
const onFinish = async () => {
|
||
|
try {
|
||
|
await loadSharedView(route.params.viewId as string, formState.value.password)
|
||
|
vModel.value = false
|
||
|
} catch (e: any) {
|
||
|
console.error(e)
|
||
2 years ago
|
message.error(await extractSdkResponseErrorMsg(e))
|
||
2 years ago
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<template>
|
||
|
<a-modal
|
||
|
v-model:visible="vModel"
|
||
|
:closable="false"
|
||
|
width="28rem"
|
||
|
centered
|
||
|
:footer="null"
|
||
|
:mask-closable="false"
|
||
|
@close="vModel = false"
|
||
|
>
|
||
|
<div class="w-full flex flex-col">
|
||
|
<a-typography-title :level="4">This shared view is protected</a-typography-title>
|
||
|
<a-form ref="formRef" :model="formState" class="mt-2" @finish="onFinish">
|
||
|
<a-form-item name="password" :rules="[{ required: true, message: 'Password is required' }]">
|
||
|
<a-input-password v-model:value="formState.password" placeholder="Enter password" />
|
||
|
</a-form-item>
|
||
|
<a-button type="primary" html-type="submit">Unlock</a-button>
|
||
|
</a-form>
|
||
|
</div>
|
||
|
</a-modal>
|
||
|
</template>
|
||
|
|
||
|
<style scoped lang="scss"></style>
|