adds an init method to the tables store
This commit is contained in:
parent
e83cebde03
commit
7bb01a152c
|
@ -69,20 +69,14 @@ export const getFrontendStore = () => {
|
|||
// Initialise backend stores
|
||||
const [
|
||||
_integrations,
|
||||
_tables,
|
||||
] = await Promise.all([
|
||||
api.get("/api/integrations").then(r => r.json()),
|
||||
api.get(`/api/tables`).then(r => r.json()),
|
||||
api.get("/api/integrations").then(r => r.json())
|
||||
])
|
||||
datasources.init()
|
||||
integrations.set(_integrations)
|
||||
queries.init()
|
||||
database.set(application.instance)
|
||||
tables.set({
|
||||
list: _tables,
|
||||
selected: {},
|
||||
draft: {},
|
||||
})
|
||||
tables.init()
|
||||
},
|
||||
routing: {
|
||||
fetch: async () => {
|
||||
|
|
|
@ -71,10 +71,18 @@ export function createTablesStore() {
|
|||
|
||||
return {
|
||||
subscribe,
|
||||
set,
|
||||
fetch,
|
||||
select,
|
||||
save,
|
||||
init: async () => {
|
||||
const response = await api.get("/api/tables")
|
||||
const json = await response.json()
|
||||
set({
|
||||
list: json,
|
||||
selected: {},
|
||||
draft: {},
|
||||
})
|
||||
},
|
||||
delete: async table => {
|
||||
await api.delete(`/api/tables/${table._id}/${table._rev}`)
|
||||
update(state => ({
|
||||
|
|
Loading…
Reference in New Issue