summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-plugin-search/src/reducers
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-09-29 17:20:29 +0200
committerSamy Pesse <samypesse@gmail.com>2016-09-29 17:20:29 +0200
commit6015defe11bbdd3bc008cf194e7e88181fe165d0 (patch)
tree2dbb26295ada4de37a6a3778d99287ff8ad14e2e /packages/gitbook-plugin-search/src/reducers
parent7f283791544195fa70c51003db9be3f029c014ef (diff)
downloadgitbook-6015defe11bbdd3bc008cf194e7e88181fe165d0.zip
gitbook-6015defe11bbdd3bc008cf194e7e88181fe165d0.tar.gz
gitbook-6015defe11bbdd3bc008cf194e7e88181fe165d0.tar.bz2
Integrate search in default theme
Diffstat (limited to 'packages/gitbook-plugin-search/src/reducers')
-rw-r--r--packages/gitbook-plugin-search/src/reducers/search.js14
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)