chore(SlateLayout): remove update-layout

This commit is contained in:
Aminejv 2021-08-12 16:51:32 +01:00
parent c3d0b488ac
commit 377115128f
3 changed files with 0 additions and 61 deletions

View File

@ -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`, {

View File

@ -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",

View File

@ -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 });
};