mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 14:49:53 +00:00
30 lines
456 B
JavaScript
30 lines
456 B
JavaScript
const TABS_SELECT = 'tabs/select';
|
|
|
|
|
|
// ~~~~~~~~ //
|
|
// REDUCERS //
|
|
// ~~~~~~~~ //
|
|
|
|
export default function (state = {}, action) {
|
|
switch (action.type) {
|
|
|
|
case TABS_SELECT:
|
|
return Object.assign({}, state.tabs, {
|
|
[action.id]: action.selectedIndex
|
|
});
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
}
|
|
|
|
|
|
// ~~~~~~~ //
|
|
// ACTIONS //
|
|
// ~~~~~~~ //
|
|
|
|
export function select (id, selectedIndex) {
|
|
return {type: TABS_SELECT, id, selectedIndex}
|
|
}
|
|
|