Previous selected tab as redux
This commit is contained in:
parent
98bc2326ee
commit
2c366ac3b1
8 changed files with 64 additions and 15 deletions
19
src/background/reducers/tab.js
Normal file
19
src/background/reducers/tab.js
Normal 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;
|
||||
}
|
||||
}
|
||||
|
Reference in a new issue