insomnia/app/redux/modules/workspaces.js
Gregory Schier e9d64ebb23 Workspaces (#7)
* Got a hacky workspace implementation running

* Removed some hax with reducer composition

* Moved some more around

* Moved files back out

* Started on entities reducer

* Split up some components

* Moved nested modules back out of workspaces

* Started on new Sidebar tree stuff

* Better store stuff

* Some more tweaks

* Removed workspace update action

* Re-implemented filtering in the Sidbare

* Switch to get the newest response
2016-04-26 00:29:24 -07:00

39 lines
767 B
JavaScript

import {combineReducers} from 'redux'
import {MODAL_WORKSPACE_RENAME} from '../../lib/constants'
import {show} from './modals'
export const WORKSPACE_ACTIVATE = 'workspaces/activate';
// ~~~~~~~~ //
// REDUCERS //
// ~~~~~~~~ //
function activeReducer (state = null, action) {
switch (action.type) {
case WORKSPACE_ACTIVATE:
return action.workspace._id;
default:
return state;
}
}
export default combineReducers({
activeId: activeReducer
});
// ~~~~~~~ //
// ACTIONS //
// ~~~~~~~ //
export function activate (workspace) {
return {type: WORKSPACE_ACTIVATE, workspace};
}
export function showUpdateNamePrompt (workspace) {
const defaultValue = workspace.name;
return show(MODAL_WORKSPACE_RENAME, {defaultValue, workspace});
}