Browse Source

feat(nc-gui): use the default base id if baseId is not provided

pull/5024/head
Wing-Kam Wong 2 years ago
parent
commit
68ef30b889
  1. 16
      packages/nc-gui/components/template/Editor.vue
  2. 2
      packages/nc-gui/composables/useTable.ts

16
packages/nc-gui/components/template/Editor.vue

@ -501,12 +501,16 @@ async function importTemplate() {
} }
} }
} }
const createdTable = await $api.base.tableCreate(project?.value?.id as string, baseId as string, { const createdTable = await $api.base.tableCreate(
table_name: table.table_name, project?.value?.id as string,
// leave title empty to get a generated one based on table_name (baseId || project?.value?.bases?.[0].id)!,
title: '', {
columns: table.columns || [], table_name: table.table_name,
}) // leave title empty to get a generated one based on table_name
title: '',
columns: table.columns || [],
},
)
table.id = createdTable.id table.id = createdTable.id
table.title = createdTable.title table.title = createdTable.title

2
packages/nc-gui/composables/useTable.ts

@ -49,7 +49,7 @@ export function useTable(onTableCreate?: (tableMeta: TableType) => void, baseId?
}) })
try { try {
const tableMeta = await $api.base.tableCreate(project?.value?.id as string, baseId as string, { const tableMeta = await $api.base.tableCreate(project?.value?.id as string, (baseId || project?.value?.bases?.[0].id)!, {
...table, ...table,
columns, columns,
}) })

Loading…
Cancel
Save