diff options
Diffstat (limited to 'src/content/reducers/find.ts')
-rw-r--r-- | src/content/reducers/find.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/content/reducers/find.ts b/src/content/reducers/find.ts new file mode 100644 index 0000000..8c3e637 --- /dev/null +++ b/src/content/reducers/find.ts @@ -0,0 +1,25 @@ +import * as actions from '../actions'; + +export interface State { + keyword: string | null; + found: boolean; +} + +const defaultState: State = { + keyword: null, + found: false, +}; + +export default function reducer( + state: State = defaultState, + action: actions.FindAction, +): State { + switch (action.type) { + case actions.FIND_SET_KEYWORD: + return { ...state, + keyword: action.keyword, + found: action.found, }; + default: + return state; + } +} |