From 6fd4a94a6a3418d79b5cde5ac578b0f8feffaff5 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Fri, 23 Feb 2018 00:01:25 -0800 Subject: [PATCH] fixed Request/request bug --- react/api/channelApi.js | 4 ++-- react/components/ShowAssetDetails/view.jsx | 8 ++++---- routes/serve-routes.js | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/react/api/channelApi.js b/react/api/channelApi.js index 859af0c7..67ac5259 100644 --- a/react/api/channelApi.js +++ b/react/api/channelApi.js @@ -1,11 +1,11 @@ -import request from 'utils/request'; +import Request from 'utils/request'; const { site: { host } } = require('../../config/speechConfig.js'); export function getChannelData (name, id) { console.log('getting channel data for channel:', name, id); if (!id) id = 'none'; const url = `${host}/api/channel/data/${name}/${id}`; - return request(url); + return Request(url); }; export function getChannelClaims (name, longId, page) { diff --git a/react/components/ShowAssetDetails/view.jsx b/react/components/ShowAssetDetails/view.jsx index af3e168a..1f3b3ff5 100644 --- a/react/components/ShowAssetDetails/view.jsx +++ b/react/components/ShowAssetDetails/view.jsx @@ -12,11 +12,11 @@ const { site: { title, host } } = require('../../../config/speechConfig.js'); class ShowAssetDetails extends React.Component { render () { const { asset } = this.props; - let channelName, certificateId, name, claimId; - if (asset.claimData) { - ({ channelName, certificateId, name, claimId } = asset.claimData); - }; if (asset) { + let channelName, certificateId, name, claimId; + if (asset.claimData) { + ({ channelName, certificateId, name, claimId } = asset.claimData); + }; return (
diff --git a/routes/serve-routes.js b/routes/serve-routes.js index 040bfede..5096885d 100644 --- a/routes/serve-routes.js +++ b/routes/serve-routes.js @@ -17,7 +17,6 @@ module.exports = (app) => { } let responseType = determineResponseType(hasFileExtension, headers); if (responseType !== SERVE) { - // return res.status(200).render('index'); return handleShowRender(req, res); } // handle serve request @@ -46,7 +45,8 @@ module.exports = (app) => { getClaimIdAndServeAsset(channelName, channelClaimId, claimName, claimId, originalUrl, ip, res); }); // route to serve the winning asset at a claim or a channel page - app.get('/:claim', ({ headers, ip, originalUrl, params, query }, res) => { + app.get('/:claim', (req, res) => { + const { headers, ip, originalUrl, params } = req; // decide if this is a show request let hasFileExtension; try { @@ -56,7 +56,7 @@ module.exports = (app) => { } let responseType = determineResponseType(hasFileExtension, headers); if (responseType !== SERVE) { - return res.status(200).render('index'); + return handleShowRender(req, res); } // handle serve request // send google analytics