Updating screens API to be prefixed with /api/screens
This commit is contained in:
parent
8c6a97198f
commit
8b35abe25f
|
@ -142,7 +142,7 @@ const saveScreen = store => async screen => {
|
|||
|
||||
let savePromise
|
||||
await api
|
||||
.post(`/api/${currentPage._id}/screens`, screen)
|
||||
.post(`/api/screens/${currentPage._id}`, screen)
|
||||
.then(() => {
|
||||
if (currentPageScreens.includes(screen)) return
|
||||
|
||||
|
@ -262,7 +262,7 @@ const deleteScreens = store => (screens, pageName = null) => {
|
|||
state.pages[pageName]._screens = state.pages[pageName]._screens.filter(
|
||||
scr => scr.name !== screen.name
|
||||
)
|
||||
api.delete(`/_builder/api/pages/${pageName}/screens/${screen.name}`)
|
||||
api.delete(`/api/screens/${screen._id}/${screen._rev}`)
|
||||
}
|
||||
return state
|
||||
})
|
||||
|
|
|
@ -27,13 +27,17 @@ function generateSaveValidation() {
|
|||
|
||||
router
|
||||
.get("/api/screens", authorized(BUILDER), controller.fetch)
|
||||
.get("/api/:pageId/screens", authorized(BUILDER), controller.find)
|
||||
.get("/api/screens/:pageId", authorized(BUILDER), controller.find)
|
||||
.post(
|
||||
"/api/:pageId/screens",
|
||||
"/api/screens/:pageId",
|
||||
authorized(BUILDER),
|
||||
generateSaveValidation(),
|
||||
controller.save
|
||||
)
|
||||
.delete("/api/:screenId/:revId", authorized(BUILDER), controller.destroy)
|
||||
.delete(
|
||||
"/api/screens/:screenId/:revId",
|
||||
authorized(BUILDER),
|
||||
controller.destroy
|
||||
)
|
||||
|
||||
module.exports = router
|
||||
|
|
Loading…
Reference in New Issue