mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
39 lines
770 B
JavaScript
39 lines
770 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});
|
|
}
|