Previous selected tab as redux

This commit is contained in:
Shin'ya Ueoka 2018-05-06 16:11:40 +09:00
parent 98bc2326ee
commit 2c366ac3b1
8 changed files with 64 additions and 15 deletions

View file

@ -0,0 +1,19 @@
import actions from 'background/actions';
const defaultState = {
previousSelected: -1,
currentSelected: -1,
};
export default function reducer(state = defaultState, action = {}) {
switch (action.type) {
case actions.TAB_SELECTED:
return {
previousSelected: state.currentSelected,
currentSelected: action.tabId,
};
default:
return state;
}
}