insomnia/app/redux/modules/workspaces.js

33 lines
580 B
JavaScript
Raw Normal View History

import {combineReducers} from 'redux';
import {MODAL_WORKSPACE_RENAME} from '../../lib/constants';
2016-04-23 06:08:52 +00:00
export const WORKSPACE_ACTIVATE = 'workspaces/activate';
// ~~~~~~~~ //
// REDUCERS //
// ~~~~~~~~ //
function activeReducer (state = null, action) {
switch (action.type) {
case WORKSPACE_ACTIVATE:
return action.workspace._id;
2016-04-23 06:08:52 +00:00
default:
return state;
}
}
export default combineReducers({
activeId: activeReducer
2016-04-23 06:08:52 +00:00
});
// ~~~~~~~ //
// ACTIONS //
// ~~~~~~~ //
export function activate (workspace) {
return {type: WORKSPACE_ACTIVATE, workspace};
2016-04-23 06:08:52 +00:00
}