On view created
This commit is contained in:
parent
0b17d6026a
commit
df40420470
|
@ -16,13 +16,13 @@
|
|||
return
|
||||
}
|
||||
try {
|
||||
await viewsStore.create({
|
||||
const newView = await viewsStore.create({
|
||||
name,
|
||||
tableId: $tables.selected._id,
|
||||
field,
|
||||
})
|
||||
notifications.success(`View ${name} created`)
|
||||
$goto(`../../view/${encodeURIComponent(name)}`)
|
||||
$goto(`../../view/v2/${newView.id}`)
|
||||
} catch (error) {
|
||||
notifications.error("Error creating view")
|
||||
}
|
||||
|
|
|
@ -41,19 +41,17 @@ export function createViewsStore() {
|
|||
}
|
||||
|
||||
const create = async view => {
|
||||
const savedView = await API.viewV2.create(view)
|
||||
const savedViewResponse = await API.viewV2.create(view)
|
||||
const savedView = savedViewResponse.data
|
||||
|
||||
// Update tables
|
||||
tables.update(state => {
|
||||
const table = state.list.find(table => table._id === view.tableId)
|
||||
if (table) {
|
||||
if (view.originalName) {
|
||||
delete table.views[view.originalName]
|
||||
}
|
||||
table.views[view.name] = savedView
|
||||
}
|
||||
table.views[view.name] = savedView
|
||||
return { ...state }
|
||||
})
|
||||
|
||||
return savedView
|
||||
}
|
||||
|
||||
const save = async view => {
|
||||
|
|
Loading…
Reference in New Issue