mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-26 04:19:49 +03:00
chore(SlateLayout): remove update-layout
This commit is contained in:
parent
c3d0b488ac
commit
377115128f
@ -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`, {
|
||||
|
@ -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",
|
||||
|
@ -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 });
|
||||
};
|
Loading…
Reference in New Issue
Block a user