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