Skip to content

Commit

Permalink
adds image catch to mortar route
Browse files Browse the repository at this point in the history
  • Loading branch information
davelandry committed Apr 11, 2019
1 parent ca99ca1 commit eeb1bc2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/mortarRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ module.exports = function(app) {

const {id} = attribute;
const origin = `http${ req.connection.encrypted ? "s" : "" }://${ req.headers.host }`;
const image = await axios.get(`${origin}/api/profile/${slug}/${id}/json`).then(resp => resp.data);
const image = await axios.get(`${origin}/api/profile/${slug}/${id}/json`)
.then(resp => resp.data)
.catch(() => ({}));

/* The following Promises, as opposed to being nested, are run sequentially.
* Each one returns a new promise, whose response is then handled in the following block
Expand Down

0 comments on commit eeb1bc2

Please sign in to comment.