Skip to content

Commit

Permalink
Fixed path issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Durgaprasad-Budhwani committed Feb 14, 2018
1 parent d6959e2 commit 36a77cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/content/gitcontent/gitcontent.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class GitContent extends PureComponent<Props> {
<Card className="fullHeight">
<Route render={({ location }) => {
const query = qs.parse(location.search);
console.log(query);
if ((query['?p'] || query.p) || (location.pathname !== '/' && location.pathname !== '')) {
const pathname = query['?p'] || query.p;
if ((pathname && pathname !== '/') || (location.pathname !== '/' && location.pathname !== '')) {
return <ReadMe />;
}
return <Info />;
Expand Down
9 changes: 3 additions & 6 deletions src/components/content/gitcontent/readme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,16 @@ class ReadMeContainer extends PureComponent<Props> {
const query = qs.parse(this.props.location.search);
if (query['?p'] || query.p) {
const pathname = query['?p'] || query.p;
if (pathname.startsWith('/')) {
this._getReadMe(pathname);
} else {
this._getReadMe(`/${pathname}`);
}
const packageName = pathname.startsWith('/') ? pathname.substr(1, pathname.length) : pathname;
this._getReadMe(packageName);
} else {
this._getReadMe(this.props.location.pathname);
}
}

componentWillReceiveProps(nextProps : Props) {
if (nextProps.location.pathname && this.props.location.pathname !== nextProps.location.pathname) {
this._getReadMe(this.props.location.pathname);
this._getReadMe(nextProps.location.pathname);
}
}

Expand Down

0 comments on commit 36a77cb

Please sign in to comment.