1
0
Fork 0
mirror of synced 2024-10-01 17:47:46 +13:00

adds an init method to the tables store

This commit is contained in:
Keviin Åberg Kultalahti 2021-03-30 11:32:01 +02:00
parent d22d5c7c28
commit 71dc4938da
2 changed files with 11 additions and 9 deletions

View file

@ -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 () => {

View file

@ -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 => ({