Use patch when detaching screen custom layouts
This commit is contained in:
parent
099bddab91
commit
99c3323390
1 changed files with 10 additions and 8 deletions
|
@ -294,25 +294,27 @@ export const getFrontendStore = () => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
if (existingHomeScreen) {
|
if (existingHomeScreen) {
|
||||||
const patchFn = screen => (screen.routing.homeScreen = false)
|
const patch = screen => (screen.routing.homeScreen = false)
|
||||||
promises.push(
|
promises.push(
|
||||||
store.actions.screens.patch(existingHomeScreen._id, patchFn)
|
store.actions.screens.patch(existingHomeScreen._id, patch)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the passed in screen
|
// Update the passed in screen
|
||||||
const patchFn = screen => (screen.routing.homeScreen = makeHomeScreen)
|
const patch = screen => (screen.routing.homeScreen = makeHomeScreen)
|
||||||
promises.push(store.actions.screens.patch(screen._id, patchFn))
|
promises.push(store.actions.screens.patch(screen._id, patch))
|
||||||
return await Promise.all(promises)
|
return await Promise.all(promises)
|
||||||
},
|
},
|
||||||
removeCustomLayout: async screen => {
|
removeCustomLayout: async screen => {
|
||||||
// Pull relevant settings from old layout, if required
|
// Pull relevant settings from old layout, if required
|
||||||
const layout = get(store).layouts.find(x => x._id === screen.layoutId)
|
const layout = get(store).layouts.find(x => x._id === screen.layoutId)
|
||||||
screen.layoutId = null
|
const patch = screen => {
|
||||||
screen.showNavigation = layout?.props.navigation !== "None"
|
screen.layoutId = null
|
||||||
screen.width = layout?.props.width || "Large"
|
screen.showNavigation = layout?.props.navigation !== "None"
|
||||||
await store.actions.screens.save(screen)
|
screen.width = layout?.props.width || "Large"
|
||||||
|
}
|
||||||
|
await store.actions.screens.patch(screen._id, patch)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
preview: {
|
preview: {
|
||||||
|
|
Loading…
Reference in a new issue