slate: consistency adjustments for constants

This commit is contained in:
@wwwjim 2020-08-25 13:09:08 -07:00
parent 0ed8cd6df5
commit 6196f3a568
3 changed files with 13 additions and 8 deletions

View File

@ -28,6 +28,7 @@ export default class SlateMediaObjectPreview extends React.Component {
// NOTE(jim):
// This is a hack to catch this undefined case I don't want to track down yet.
const url = this.props.url.replace("https://undefined", "https://");
console.log(url);
let element = <div css={STYLES_ENTITY}>No Preview</div>;

View File

@ -1,5 +1,5 @@
import * as MW from "~/node_common/middleware";
import { IPFS_GATEWAY_DOMAIN } from "~/node_common/constants";
import * as Constants from "~/node_common/constants";
import * as Utilities from "~/node_common/utilities";
import * as Data from "~/node_common/data";
@ -12,7 +12,9 @@ export default async (req, res) => {
const id = Utilities.getIdFromCookie(req);
if (!id) {
return res.status(403).json({ decorator: "SERVER_ADD_TO_SLATE_USER_NOT_FOUND", error: true });
return res
.status(403)
.json({ decorator: "SERVER_ADD_TO_SLATE_USER_NOT_FOUND", error: true });
}
const user = await Data.getUserById({
@ -49,7 +51,7 @@ export default async (req, res) => {
});
}
const cid = req.body.data.ipfs.replace('/ipfs/')
const cid = req.body.data.ipfs.replace("/ipfs/");
const objects = [
...slate.data.objects,
{
@ -58,7 +60,7 @@ export default async (req, res) => {
name: req.body.data.name,
title: req.body.data.title,
type: req.body.data.type,
url: `https://${cid}.${IPFS_GATEWAY_DOMAIN}`
url: `https://${cid}.${Constants.IPFS_GATEWAY_DOMAIN}`,
},
];
@ -102,5 +104,7 @@ export default async (req, res) => {
});
}
return res.status(200).json({ decorator: "SERVER_SLATE_ADD_TO_SLATE", slate });
return res
.status(200)
.json({ decorator: "SERVER_SLATE_ADD_TO_SLATE", slate });
};

View File

@ -1,6 +1,6 @@
import * as MW from "~/node_common/middleware";
import * as Data from "~/node_common/data";
import { IPFS_GATEWAY_DOMAIN } from "~/node_common/constants";
import * as Constants from "~/node_common/constants";
import * as LibraryManager from "~/node_common/managers/library";
import * as Strings from "~/common/strings";
import * as Upload from "~/node_common/upload";
@ -114,8 +114,8 @@ export default async (req, res) => {
});
}
const cid = req.body.data.ipfs.replace('/ipfs/')
const url = `https://${cid}.${IPFS_GATEWAY_DOMAIN}`
const cid = req.body.data.ipfs.replace("/ipfs/");
const url = `https://${cid}.${Constants.IPFS_GATEWAY_DOMAIN}`;
const newSlateObjectEntity = {
id: updatedData.id,
name: updatedData.name,