|
|
|
@ -38,6 +38,8 @@ export function useViewData(
|
|
|
|
|
throw new Error('Table meta is not available') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const loading = ref(false) |
|
|
|
|
const error = ref<any>() |
|
|
|
|
const _paginationData = ref<PaginatedType>({ page: 1, pageSize: 25 }) |
|
|
|
|
const aggCommentCount = ref<{ row_id: string; count: number }[]>([]) |
|
|
|
|
const galleryData = ref<GalleryType>() |
|
|
|
@ -113,8 +115,10 @@ export function useViewData(
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const loadData = async (params: Parameters<Api<any>['dbViewRow']['list']>[4] = {}) => { |
|
|
|
|
try { |
|
|
|
|
if ((!project?.value?.id || !meta?.value?.id || !viewMeta?.value?.id) && !isPublic.value) return |
|
|
|
|
|
|
|
|
|
loading.value = true |
|
|
|
|
error.value = null |
|
|
|
|
const response = !isPublic.value |
|
|
|
|
? await $api.dbViewRow.list('noco', project.value.id!, meta.value.id!, viewMeta!.value.id, { |
|
|
|
|
...params, |
|
|
|
@ -127,6 +131,11 @@ export function useViewData(
|
|
|
|
|
paginationData.value = response.pageInfo |
|
|
|
|
|
|
|
|
|
await loadAggCommentsCount() |
|
|
|
|
} catch (e: any) { |
|
|
|
|
error.value = e |
|
|
|
|
} finally { |
|
|
|
|
loading.value = false |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const loadGalleryData = async () => { |
|
|
|
@ -351,6 +360,8 @@ export function useViewData(
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
error, |
|
|
|
|
loading, |
|
|
|
|
loadData, |
|
|
|
|
paginationData, |
|
|
|
|
queryParams, |
|
|
|
|