Browse Source

fix(gui-v2): add try catch to list apis

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2990/head
Pranav C 2 years ago
parent
commit
e81fefd395
  1. 74
      packages/nc-gui-v2/composables/useLTARStore.ts

74
packages/nc-gui-v2/composables/useLTARStore.ts

@ -65,39 +65,53 @@ const [useProvideLTARStore, useLTARStore] = useInjectionState(
}) })
const loadChildrenExcludedList = async () => { const loadChildrenExcludedList = async () => {
childrenExcludedList.value = await $api.dbTableRow.nestedChildrenExcludedList( try {
NOCO, childrenExcludedList.value = await $api.dbTableRow.nestedChildrenExcludedList(
project.value.id as string, NOCO,
meta.value.id, project.value.id as string,
rowId.value, meta.value.id,
(column.colOptions as LinkToAnotherRecordType).type as 'mm' | 'hm', rowId.value,
column.title, (column.colOptions as LinkToAnotherRecordType).type as 'mm' | 'hm',
// todo: swagger type correction column.title,
{ // todo: swagger type correction
limit: childrenExcludedListPagination.size, {
offset: childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1), limit: childrenExcludedListPagination.size,
where: offset: childrenExcludedListPagination.size * (childrenExcludedListPagination.page - 1),
childrenExcludedListPagination.query && where:
`(${relatedTablePrimaryValueProp.value},like,${childrenExcludedListPagination.query})`, childrenExcludedListPagination.query &&
} as any, `(${relatedTablePrimaryValueProp.value},like,${childrenExcludedListPagination.query})`,
) } as any,
)
} catch (e: any) {
notification.error({
message: 'Failed to load list',
description: await extractSdkResponseErrorMsg(e),
})
}
} }
const loadChildrenList = async () => { const loadChildrenList = async () => {
childrenList.value = await $api.dbTableRow.nestedList( try {
NOCO, childrenList.value = await $api.dbTableRow.nestedList(
project.value.id as string, NOCO,
meta.value.id, project.value.id as string,
rowId.value, meta.value.id,
colOptions.type as 'mm' | 'hm', rowId.value,
column.title, colOptions.type as 'mm' | 'hm',
// todo: swagger type correction column.title,
{ // todo: swagger type correction
limit: childrenListPagination.size, {
offset: childrenListPagination.size * (childrenListPagination.page - 1), limit: childrenListPagination.size,
where: childrenListPagination.query && `(${relatedTablePrimaryValueProp.value},like,${childrenListPagination.query})`, offset: childrenListPagination.size * (childrenListPagination.page - 1),
} as any, where: childrenListPagination.query && `(${relatedTablePrimaryValueProp.value},like,${childrenListPagination.query})`,
) } as any,
)
} catch (e: any) {
notification.error({
message: 'Failed to load children list',
description: await extractSdkResponseErrorMsg(e),
})
}
} }
const deleteRelatedRow = async (row: Record<string, any>) => { const deleteRelatedRow = async (row: Record<string, any>) => {

Loading…
Cancel
Save