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

Loading…
Cancel
Save