Merge pull request #479 from Budibase/persisting-table-name

ensure table name is not persisted between apps
This commit is contained in:
Martin McKeaveney 2020-07-21 12:21:54 +01:00 committed by GitHub
commit e84c06d3d2
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