diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-09-29 17:20:29 +0200 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-09-29 17:20:29 +0200 |
commit | 6015defe11bbdd3bc008cf194e7e88181fe165d0 (patch) | |
tree | 2dbb26295ada4de37a6a3778d99287ff8ad14e2e /packages/gitbook-plugin-search/src/reducers/search.js | |
parent | 7f283791544195fa70c51003db9be3f029c014ef (diff) | |
download | gitbook-6015defe11bbdd3bc008cf194e7e88181fe165d0.zip gitbook-6015defe11bbdd3bc008cf194e7e88181fe165d0.tar.gz gitbook-6015defe11bbdd3bc008cf194e7e88181fe165d0.tar.bz2 |
Integrate search in default theme
Diffstat (limited to 'packages/gitbook-plugin-search/src/reducers/search.js')
-rw-r--r-- | packages/gitbook-plugin-search/src/reducers/search.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/gitbook-plugin-search/src/reducers/search.js b/packages/gitbook-plugin-search/src/reducers/search.js index ac49698..9c99634 100644 --- a/packages/gitbook-plugin-search/src/reducers/search.js +++ b/packages/gitbook-plugin-search/src/reducers/search.js @@ -3,12 +3,6 @@ const { Record, List, OrderedMap } = GitBook.Immutable; const TYPES = require('../actions/types'); -const Result = Record({ - url: String(''), - title: String(''), - body: String('') -}); - const SearchState = Record({ // Current query query: String(''), @@ -21,6 +15,14 @@ const SearchState = Record({ module.exports = (state = SearchState(), action) => { switch (action.type) { + case TYPES.CLEAR: + return SearchState(); + + case TYPES.UPDATE_QUERY: + return state.merge({ + query: action.query + }); + case TYPES.REGISTER_HANDLER: return state.merge({ handlers: state.handlers.set(action.name, action.handler) |