mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
Merge pull request #2058 from LLK/hotfix/search-default-mode
[DEVELOP] Hotfix/search default mode
This commit is contained in:
commit
39aa73c095
1 changed files with 6 additions and 3 deletions
|
@ -18,7 +18,7 @@ const Tabs = require('../../components/tabs/tabs.jsx');
|
|||
const Page = require('../../components/page/www/page.jsx');
|
||||
const render = require('../../lib/render.jsx');
|
||||
|
||||
const ACCEPTABLE_MODES = ['trending', 'popular', ''];
|
||||
const ACCEPTABLE_MODES = ['trending', 'popular'];
|
||||
|
||||
require('./search.scss');
|
||||
|
||||
|
@ -34,7 +34,7 @@ class Search extends React.Component {
|
|||
this.state = this.getSearchState();
|
||||
this.state.loaded = [];
|
||||
this.state.loadNumber = 16;
|
||||
this.state.mode = '';
|
||||
this.state.mode = 'popular';
|
||||
this.state.offset = 0;
|
||||
this.state.loadMore = false;
|
||||
|
||||
|
@ -51,8 +51,11 @@ class Search extends React.Component {
|
|||
mode = mode.substring(0, mode.indexOf('&'));
|
||||
}
|
||||
mode = decodeURIComponent(mode.split('+').join(' '));
|
||||
if (ACCEPTABLE_MODES.indexOf(mode) !== -1) {
|
||||
this.state.mode = mode;
|
||||
}
|
||||
|
||||
}
|
||||
componentDidMount () {
|
||||
const query = window.location.search;
|
||||
const q = query.lastIndexOf('q=');
|
||||
|
|
Loading…
Reference in a new issue