diff --git a/common/actions.js b/common/actions.js index 73602693..f5655e19 100644 --- a/common/actions.js +++ b/common/actions.js @@ -340,14 +340,6 @@ export const updateSlate = async (data) => { }); }; -export const updateSlateLayout = async (data) => { - await Websockets.checkWebsocket(); - return await returnJSON(`/api/slates/update-layout`, { - ...DEFAULT_OPTIONS, - body: JSON.stringify({ data }), - }); -}; - export const deleteSlate = async (data) => { await Websockets.checkWebsocket(); return await returnJSON(`/api/slates/delete`, { diff --git a/common/messages.js b/common/messages.js index 16131edd..91562df3 100644 --- a/common/messages.js +++ b/common/messages.js @@ -108,12 +108,6 @@ export const error = { SERVER_REMOVE_FROM_SLATE_SLATE_NOT_FOUND: "We are having trouble locating that collection", SERVER_REMOVE_FROM_SLATE_FAILED: "We are having trouble removing from that collection right now", - //Update slate layout - SERVER_UPDATE_SLATE_LAYOUT_MUST_PROVIDE_DATA: "No layout was provided to update", - SERVER_UPDATE_SLATE_LAYOUT_NOT_FOUND: "We are having trouble locating that collection", - SERVER_UPDATE_SLATE_LAYOUT: - "We are unable to update that collection's layout right now. Please try again later", - //Update slate SERVER_UPDATE_SLATE_MUST_PROVIDE_DATA: "We are unable to update that collection because no data was provided", diff --git a/pages/api/slates/update-layout.js b/pages/api/slates/update-layout.js deleted file mode 100644 index 34bbc538..00000000 --- a/pages/api/slates/update-layout.js +++ /dev/null @@ -1,47 +0,0 @@ -import * as Utilities from "~/node_common/utilities"; -import * as Data from "~/node_common/data"; -import * as Strings from "~/common/strings"; -import * as ViewerManager from "~/node_common/managers/viewer"; - -export default async (req, res) => { - if (!req.body.data) { - return res.status(500).send({ - decorator: "SERVER_UPDATE_SLATE_LAYOUT_MUST_PROVIDE_DATA", - error: true, - }); - } - - const slate = await Data.getSlateById({ id: req.body.data.id }); - - if (!slate) { - return res.status(404).send({ decorator: "SERVER_UPDATE_SLATE_LAYOUT_NOT_FOUND", error: true }); - } - - if (slate.error) { - return res.status(500).send({ decorator: "SERVER_UPDATE_SLATE_LAYOUT_NOT_FOUND", error: true }); - } - - let update = await Data.updateSlateById({ - id: slate.id, - data: { - ...slate.data, - layouts: req.body.data.layouts, - }, - }); - - if (!update) { - return res.status(404).send({ decorator: "SERVER_UPDATE_SLATE_LAYOUT", error: true }); - } - - if (update.error) { - return res.status(500).send({ decorator: "SERVER_UPDATE_SLATE_LAYOUT", error: true }); - } - - const id = Utilities.getIdFromCookie(req); - - if (id && slate.ownerId === id) { - ViewerManager.hydratePartial(id, { slates: true }); - } - - return res.status(200).send({ decorator: "SERVER_UPDATE_SLATE_LAYOUT", slate }); -};