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');
|
const { site: { host } } = require('../../config/speechConfig.js');
|
||||||
|
|
||||||
export function getChannelData (name, id) {
|
export function getChannelData (name, id) {
|
||||||
console.log('getting channel data for channel:', name, id);
|
console.log('getting channel data for channel:', name, id);
|
||||||
if (!id) id = 'none';
|
if (!id) id = 'none';
|
||||||
const url = `${host}/api/channel/data/${name}/${id}`;
|
const url = `${host}/api/channel/data/${name}/${id}`;
|
||||||
return request(url);
|
return Request(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function getChannelClaims (name, longId, page) {
|
export function getChannelClaims (name, longId, page) {
|
||||||
|
|
|
@ -12,11 +12,11 @@ const { site: { title, host } } = require('../../../config/speechConfig.js');
|
||||||
class ShowAssetDetails extends React.Component {
|
class ShowAssetDetails extends React.Component {
|
||||||
render () {
|
render () {
|
||||||
const { asset } = this.props;
|
const { asset } = this.props;
|
||||||
let channelName, certificateId, name, claimId;
|
|
||||||
if (asset.claimData) {
|
|
||||||
({ channelName, certificateId, name, claimId } = asset.claimData);
|
|
||||||
};
|
|
||||||
if (asset) {
|
if (asset) {
|
||||||
|
let channelName, certificateId, name, claimId;
|
||||||
|
if (asset.claimData) {
|
||||||
|
({ channelName, certificateId, name, claimId } = asset.claimData);
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
|
|
|
@ -17,7 +17,6 @@ module.exports = (app) => {
|
||||||
}
|
}
|
||||||
let responseType = determineResponseType(hasFileExtension, headers);
|
let responseType = determineResponseType(hasFileExtension, headers);
|
||||||
if (responseType !== SERVE) {
|
if (responseType !== SERVE) {
|
||||||
// return res.status(200).render('index');
|
|
||||||
return handleShowRender(req, res);
|
return handleShowRender(req, res);
|
||||||
}
|
}
|
||||||
// handle serve request
|
// handle serve request
|
||||||
|
@ -46,7 +45,8 @@ module.exports = (app) => {
|
||||||
getClaimIdAndServeAsset(channelName, channelClaimId, claimName, claimId, originalUrl, ip, res);
|
getClaimIdAndServeAsset(channelName, channelClaimId, claimName, claimId, originalUrl, ip, res);
|
||||||
});
|
});
|
||||||
// route to serve the winning asset at a claim or a channel page
|
// 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
|
// decide if this is a show request
|
||||||
let hasFileExtension;
|
let hasFileExtension;
|
||||||
try {
|
try {
|
||||||
|
@ -56,7 +56,7 @@ module.exports = (app) => {
|
||||||
}
|
}
|
||||||
let responseType = determineResponseType(hasFileExtension, headers);
|
let responseType = determineResponseType(hasFileExtension, headers);
|
||||||
if (responseType !== SERVE) {
|
if (responseType !== SERVE) {
|
||||||
return res.status(200).render('index');
|
return handleShowRender(req, res);
|
||||||
}
|
}
|
||||||
// handle serve request
|
// handle serve request
|
||||||
// send google analytics
|
// send google analytics
|
||||||
|
|
Loading…
Reference in a new issue