fix default sort

This commit is contained in:
igoradamenko
2018-05-12 21:42:15 +03:00
parent 89e4e75b00
commit cc1894caa4
2 changed files with 5 additions and 3 deletions
+2
View File
@@ -11,6 +11,7 @@ const PROVIDER_NAMES = {
facebook: 'Facebook',
github: 'GitHub',
};
const DEFAULT_SORT = '-score';
module.exports = {
BASE_URL,
@@ -22,4 +23,5 @@ module.exports = {
DEFAULT_LAST_COMMENTS_MAX,
DEFAULT_MAX_COMMENT_SIZE,
PROVIDER_NAMES,
DEFAULT_SORT,
};
+3 -3
View File
@@ -1,7 +1,7 @@
import { h, Component } from 'preact';
import api from 'common/api';
import { BASE_URL, NODE_ID, COMMENT_NODE_CLASSNAME_PREFIX } from 'common/constants';
import { BASE_URL, NODE_ID, COMMENT_NODE_CLASSNAME_PREFIX, DEFAULT_SORT } from 'common/constants';
import { url } from 'common/settings';
import store from 'common/store';
@@ -21,9 +21,9 @@ export default class Root extends Component {
let sort;
try {
sort = localStorage.getItem(LS_SORT_KEY);
sort = localStorage.getItem(LS_SORT_KEY) || DEFAULT_SORT;
} catch(e) {
sort = '-score';
sort = DEFAULT_SORT;
}
this.state = {