fixed Request/request bug
This commit is contained in:
parent
e6146db781
commit
6fd4a94a6a
3 changed files with 9 additions and 9 deletions
|
@ -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) {
|
||||
|
|
|
@ -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 (
|
||||
<div>
|
||||
<Helmet>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue