Merge pull request #1071 from lbryio/redirect2

prevent server side redirect
This commit is contained in:
jessopb 2020-06-11 12:30:31 -04:00 committed by GitHub
commit 99c7b087d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 10 deletions

View file

@ -15,21 +15,23 @@ import {
class ContentPageWrapper extends React.Component { class ContentPageWrapper extends React.Component {
componentDidMount () { componentDidMount () {
const { onHandleShowPageUri, match, homeChannel } = this.props; const { onHandleShowPageUri, match, homeChannel } = this.props;
onHandleShowPageUri(homeChannel ? { claim: homeChannel } : match.params); //onHandleShowPageUri(homeChannel ? { claim: homeChannel } : match.params);
} }
componentWillReceiveProps (nextProps) { componentWillReceiveProps (nextProps) {
if (nextProps.match.params !== this.props.match.params) { if (nextProps.match.params !== this.props.match.params) {
this.props.onHandleShowPageUri(nextProps.match.params); //this.props.onHandleShowPageUri(nextProps.match.params);
} }
} }
render () { render () {
const { error, requestType, match } = this.props; const { error, requestType, match } = this.props;
const { params } = match; const { params } = match;
const { claim, identifier } = params; const { claim, identifier } = params;
if (identifier) { if (identifier && claim) {
return <Redirect to={`https://lbry.tv/${identifier}/${claim}`} /> return <Redirect to={`https://lbry.tv/${identifier}/${claim}`} />;
} else if (identifier) {
// return <Redirect to={`https://lbry.tv/${identifier}/`} />
} else { } else {
return <Redirect to={`https://lbry.tv/${claim}`} /> return <Redirect to={`https://lbry.tv/${claim}`} />;
} }
if (error) { if (error) {
return ( return (
@ -38,13 +40,13 @@ class ContentPageWrapper extends React.Component {
} }
switch (requestType) { switch (requestType) {
case CHANNEL: case CHANNEL:
return <ShowChannel />; // return <ShowChannel />;
case ASSET_LITE: case ASSET_LITE:
return <ShowAssetLite />; // return <ShowAssetLite />;
case ASSET_DETAILS: case ASSET_DETAILS:
return <ShowAssetDetails />; // return <ShowAssetDetails />;
case SPECIAL_ASSET: case SPECIAL_ASSET:
return <ShowChannel />; // return <ShowChannel />;
default: default:
return <p>loading...</p>; return <p>loading...</p>;
} }

View file

@ -2,6 +2,6 @@ module.exports = {
...require('./pages').default, ...require('./pages').default,
...require('./api').default, ...require('./api').default,
...require('./auth').default, ...require('./auth').default,
...require('./assets').default, // ...require('./assets').default,
...require('./fallback').default, ...require('./fallback').default,
}; };