mirror of https://github.com/Budibase/budibase.git
7 changed files with 45 additions and 25 deletions
@ -0,0 +1,27 @@ |
|||
import * as API from "../api" |
|||
import { get, writable } from "svelte/store" |
|||
|
|||
const createAppStore = () => { |
|||
const store = writable({}) |
|||
|
|||
// Fetches the app definition including screens, layouts and theme
|
|||
const fetchAppDefinition = async () => { |
|||
const appDefinition = await API.fetchAppPackage(get(store).appId) |
|||
store.set(appDefinition) |
|||
} |
|||
|
|||
// Sets the initial app ID
|
|||
const setAppID = id => { |
|||
store.update(state => { |
|||
state.appId = id |
|||
return state |
|||
}) |
|||
} |
|||
|
|||
return { |
|||
subscribe: store.subscribe, |
|||
actions: { setAppID, fetchAppDefinition }, |
|||
} |
|||
} |
|||
|
|||
export const appStore = createAppStore() |
|||
@ -1,7 +1,7 @@ |
|||
import { routeStore } from "./routes" |
|||
import { screenStore } from "./screens" |
|||
import { appStore } from "./app" |
|||
|
|||
export async function initialise() { |
|||
await routeStore.actions.fetchRoutes() |
|||
await screenStore.actions.fetchScreens() |
|||
await appStore.actions.fetchAppDefinition() |
|||
} |
|||
|
|||
Loading…
Reference in new issue