WIP - fix lookup field
This commit is contained in:
@@ -12,11 +12,11 @@ interface Props {
|
||||
field: FieldConfig
|
||||
modelValue: string | null // The ID of the selected record
|
||||
readonly?: boolean
|
||||
baseUrl?: string // Base API URL, defaults to '/api/central'
|
||||
baseUrl?: string // Base API URL, defaults to '/central'
|
||||
}
|
||||
|
||||
const props = withDefaults(defineProps<Props>(), {
|
||||
baseUrl: '/api/central',
|
||||
baseUrl: '/central',
|
||||
modelValue: null,
|
||||
})
|
||||
|
||||
@@ -24,7 +24,7 @@ const emit = defineEmits<{
|
||||
'update:modelValue': [value: string | null]
|
||||
}>()
|
||||
|
||||
const { $api } = useNuxtApp() as unknown as { $api: Function }
|
||||
const { api } = useApi()
|
||||
const open = ref(false)
|
||||
const searchQuery = ref('')
|
||||
const records = ref<any[]>([])
|
||||
@@ -56,7 +56,7 @@ const filteredRecords = computed(() => {
|
||||
const fetchRecords = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const response = await $api(`${props.baseUrl}/${relationObject.value}`)
|
||||
const response = await api.get(`${props.baseUrl}/${relationObject.value}`)
|
||||
records.value = response || []
|
||||
|
||||
// If we have a modelValue, find the selected record
|
||||
|
||||
Reference in New Issue
Block a user