Rename m query parameter to mode

This commit is contained in:
kyleplo 2018-07-31 17:26:03 -04:00 committed by GitHub
parent 9bf2f7d436
commit a6bb77de8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,9 +53,9 @@ class Search extends React.Component {
this.props.dispatch(navigationActions.setSearchTerm(term)); this.props.dispatch(navigationActions.setSearchTerm(term));
let mode = ''; let mode = '';
const m = query.lastIndexOf('m='); const m = query.lastIndexOf('mode=');
if (m !== -1) { if (m !== -1) {
mode = query.substring(m + 2, query.length).toLowerCase(); mode = query.substring(m + 5, query.length).toLowerCase();
} }
while (mode.indexOf('/') > -1) { while (mode.indexOf('/') > -1) {
mode = mode.substring(0, term.indexOf('/')); mode = mode.substring(0, term.indexOf('/'));
@ -89,7 +89,7 @@ class Search extends React.Component {
if (this.state.acceptableModes.indexOf(value) !== -1) { if (this.state.acceptableModes.indexOf(value) !== -1) {
const term = this.props.searchTerm.split(' ').join('+'); const term = this.props.searchTerm.split(' ').join('+');
window.location = window.location =
`${window.location.origin}/search/${this.state.tab}?q=${term}&m=${value}`; `${window.location.origin}/search/${this.state.tab}?q=${term}&mode=${value}`;
} }
} }
handleGetSearchMore () { handleGetSearchMore () {