hotfix: fixes server crashing conditions

This commit is contained in:
jimmylee 2020-08-22 18:32:41 -07:00
parent f67c08fbc9
commit d466927624
3 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ export const getById = async ({ id }) => {
try {
data = {
id: user.id,
data: { photo: user.data.photo, body: user.data.body },
data: { photo: user.data.photo, body: user.data.body ? user.data.body : "" },
settings: {
deals_auto_approve: user.data.settings_deals_auto_approve,
},

View File

@ -28,7 +28,7 @@ export default class SceneSlate extends React.Component {
body: this.props.current.data.body,
layouts: this.props.current.data.layouts
? this.props.current.data.layouts
: generateLayout(this.props.current.data.objects),
: { lg: generateLayout(this.props.current.data.objects) },
loading: false,
};
@ -219,6 +219,8 @@ export default class SceneSlate extends React.Component {
render() {
const { slatename, objects, body = "A slate." } = this.state;
console.log(this.state.layouts);
return (
<ScenePage style={{ padding: `88px 24px 128px 24px` }}>
<ScenePageHeader

View File

@ -106,7 +106,7 @@ app.prepare().then(async () => {
viewer,
creator: {
username: creator.username,
data: { photo: creator.data.photo, body: creator.data.body },
data: { photo: creator.data.photo, body: creator.data.body ? creator.data.body : "A user on Slate." },
slates: JSON.parse(JSON.stringify(slates)),
},
});
@ -145,9 +145,7 @@ app.prepare().then(async () => {
}
return app.render(req, res, "/_/slate", {
slate: JSON.parse(
JSON.stringify({ ...slate, ownername: req.params.username })
),
slate: JSON.parse(JSON.stringify({ ...slate, ownername: req.params.username })),
});
});