update tables select method
This commit is contained in:
parent
54b99d6d4b
commit
2d1683c785
|
@ -19,13 +19,21 @@ function createTablesStore() {
|
||||||
const tables = await tablesResponse.json()
|
const tables = await tablesResponse.json()
|
||||||
update(state => ({...state, list: tables}))
|
update(state => ({...state, list: tables}))
|
||||||
},
|
},
|
||||||
select: table =>
|
select: table => {
|
||||||
|
if (!table) {
|
||||||
|
update(state => ({
|
||||||
|
...state,
|
||||||
|
selected: {}
|
||||||
|
}))
|
||||||
|
} else {
|
||||||
update(state => ({
|
update(state => ({
|
||||||
...state,
|
...state,
|
||||||
selected: table,
|
selected: table,
|
||||||
draft: cloneDeep(table),
|
draft: cloneDeep(table),
|
||||||
view: { name: `all_${table._id}` }
|
view: { name: `all_${table._id}` }
|
||||||
})),
|
}))
|
||||||
|
}
|
||||||
|
},
|
||||||
save: async table => {
|
save: async table => {
|
||||||
const updatedTable = cloneDeep(table)
|
const updatedTable = cloneDeep(table)
|
||||||
const oldTable = get(store).list.filter(t => t._id === table._id)[0]
|
const oldTable = get(store).list.filter(t => t._id === table._id)[0]
|
||||||
|
|
Loading…
Reference in New Issue