From 59f7ef205df4750063c755a7b8834bfd7509da83 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sat, 21 Oct 2017 13:26:36 +0900 Subject: add addon actions --- src/content/reducers/addon.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/content/reducers/addon.js (limited to 'src/content/reducers/addon.js') diff --git a/src/content/reducers/addon.js b/src/content/reducers/addon.js new file mode 100644 index 0000000..8cc5ef1 --- /dev/null +++ b/src/content/reducers/addon.js @@ -0,0 +1,24 @@ +import actions from 'content/actions'; + +const defaultState = { + enabled: true, +}; + +export default function reducer(state = defaultState, action = {}) { + switch (action.type) { + case actions.ADDON_ENABLE: + return Object.assign({}, state, { + enabled: true, + }); + case actions.ADDON_DISABLE: + return Object.assign({}, state, { + enabled: false, + }); + case actions.ADDON_TOGGLE_ENABLED: + return Object.assign({}, state, { + enabled: !state.enabled, + }); + default: + return state; + } +} -- cgit v1.2.3