Browse Source

Merge pull request #5024 from nocodb/fix/import

fix(nc-gui): use the default base id if baseId is not provided
pull/5043/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
38759652da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      packages/nc-gui/components/template/Editor.vue
  2. 2
      packages/nc-gui/composables/useTable.ts

8
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(
project.value?.id as string,
(baseId || project.value?.bases?.[0].id)!,
{
table_name: table.table_name, table_name: table.table_name,
// leave title empty to get a generated one based on table_name // leave title empty to get a generated one based on table_name
title: '', title: '',
columns: table.columns || [], 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