Browse Source

fix(gui-v2): inject meta to get model id

pull/2838/head
Wing-Kam Wong 2 years ago
parent
commit
6e016c5404
  1. 9
      packages/nc-gui-v2/components/webhook/Test.vue

9
packages/nc-gui-v2/components/webhook/Test.vue

@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { onMounted } from '@vue/runtime-core' import { onMounted } from '@vue/runtime-core'
import { MetaInj } from '~/context'
interface Props { interface Props {
hook: Record<string, any> hook: Record<string, any>
@ -8,8 +9,7 @@ interface Props {
const { hook } = defineProps<Props>() const { hook } = defineProps<Props>()
const { $state, $api, $e } = useNuxtApp() const { $state, $api, $e } = useNuxtApp()
const meta = inject(MetaInj)
const { getMeta, removeMeta } = useMetas()
const isVisible = ref(false) const isVisible = ref(false)
const sampleData = ref({ const sampleData = ref({
data: {}, data: {},
@ -25,16 +25,13 @@ watch(
) )
async function loadSampleData() { async function loadSampleData() {
// TODO: get model id
const modelId = 'XXX'
sampleData.value = { sampleData.value = {
data: $api.dbTableWebhook.samplePayloadGet(modelId, hook?.operation), data: $api.dbTableWebhook.samplePayloadGet(meta?.value?.id as string, hook?.operation),
user: $state.user.value as Record<string, any>, user: $state.user.value as Record<string, any>,
} }
} }
onMounted(async () => { onMounted(async () => {
console.log(hook)
await loadSampleData() await loadSampleData()
}) })
</script> </script>

Loading…
Cancel
Save