Lint and testing

This commit is contained in:
Conor_Mack 2020-06-02 11:19:22 +01:00
parent 98610c60ed
commit fa2fcb0632
1 changed files with 22 additions and 18 deletions

View File

@ -1,4 +1,3 @@
import { values } from "lodash/fp" import { values } from "lodash/fp"
import { backendUiStore } from "builderStore" import { backendUiStore } from "builderStore"
import * as backendStoreActions from "./backend" import * as backendStoreActions from "./backend"
@ -120,28 +119,33 @@ const saveScreen = store => screen => {
} }
const _saveScreen = async (store, s, screen) => { const _saveScreen = async (store, s, screen) => {
const currentPageScreens = s.pages[s.currentPageName]._screens; const currentPageScreens = s.pages[s.currentPageName]._screens
await api.post(`/_builder/api/${s.appId}/pages/${s.currentPageName}/screen`, screen).then(() => { await api
if (currentPageScreens.includes(screen)) return; .post(`/_builder/api/${s.appId}/pages/${s.currentPageName}/screen`, screen)
.then(() => {
if (currentPageScreens.includes(screen)) return
const screens = [ ...currentPageScreens, screen ]; const screens = [...currentPageScreens, screen]
store.update((innerState) => { store.update(innerState => {
innerState.pages[s.currentPageName]._screens = screens; innerState.pages[s.currentPageName]._screens = screens
innerState.screens = screens; innerState.screens = screens
innerState.currentPreviewItem = screen; innerState.currentPreviewItem = screen
const safeProps = makePropsSafe(innerState.components[screen.props._component], screen.props); const safeProps = makePropsSafe(
innerState.currentComponentInfo = safeProps; innerState.components[screen.props._component],
screen.props = safeProps; screen.props
)
innerState.currentComponentInfo = safeProps
screen.props = safeProps
_savePage(innerState); _savePage(innerState)
return innerState; return innerState
}); })
}); })
return s; return s
}; }
const createScreen = store => (screenName, route, layoutComponentName) => { const createScreen = store => (screenName, route, layoutComponentName) => {
store.update(state => { store.update(state => {