aboutsummaryrefslogtreecommitdiff
path: root/src/content/reducers/find.ts
blob: 8c3e6379340c962036cf2b25b80b00f6848b59a8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;
  }
}