1
0
Fork 0
mirror of synced 2024-09-30 17:18:14 +13:00

ensure table name is not persisted between apps

This commit is contained in:
Martin McKeaveney 2020-07-21 10:24:09 +01:00
parent c4ee632d58
commit 32cfc40fd4
2 changed files with 17 additions and 16 deletions

View file

@ -2,23 +2,24 @@ import { writable } from "svelte/store"
import { cloneDeep } from "lodash/fp"
import api from "../api"
export const getBackendUiStore = () => {
const INITIAL_BACKEND_UI_STATE = {
models: [],
views: [],
users: [],
selectedDatabase: {},
selectedModel: {},
draftModel: {},
tabs: {
SETUP_PANEL: "SETUP",
NAVIGATION_PANEL: "NAVIGATE",
},
}
const INITIAL_BACKEND_UI_STATE = {
models: [],
views: [],
users: [],
selectedDatabase: {},
selectedModel: {},
draftModel: {},
tabs: {
SETUP_PANEL: "SETUP",
NAVIGATION_PANEL: "NAVIGATE",
},
}
const store = writable(INITIAL_BACKEND_UI_STATE)
export const getBackendUiStore = () => {
const store = writable({ ...INITIAL_BACKEND_UI_STATE })
store.actions = {
reset: () => store.set({ ...INITIAL_BACKEND_UI_STATE }),
database: {
select: async db => {
const modelsResponse = await api.get(`/api/models`)
@ -78,7 +79,6 @@ export const getBackendUiStore = () => {
}
const SAVE_MODEL_URL = `/api/models`
console.log(updatedModel)
const response = await api.post(SAVE_MODEL_URL, updatedModel)
const savedModel = await response.json()
await store.actions.models.fetch()

View file

@ -1,6 +1,6 @@
<script>
import Modal from "svelte-simple-modal"
import { store, workflowStore } from "builderStore"
import { store, workflowStore, backendUiStore } from "builderStore"
import SettingsLink from "components/settings/Link.svelte"
import { get } from "builderStore/api"
@ -20,6 +20,7 @@
const pkg = await res.json()
if (res.ok) {
backendUiStore.actions.reset()
await store.setPackage(pkg)
workflowStore.actions.fetch()
return pkg