Commit c773018c authored by Karishma Chadha's avatar Karishma Chadha

Update managerCount in redux when promoting a curator or removing a manager.

parent 75687e52
...@@ -3,7 +3,7 @@ import keyMirror from 'keymirror'; ...@@ -3,7 +3,7 @@ import keyMirror from 'keymirror';
import api from '../../../lib/api'; import api from '../../../lib/api';
import {curators, managers} from './redux-modules'; import {curators, managers} from './redux-modules';
import {selectUsername} from '../../../redux/session'; import {selectUsername} from '../../../redux/session';
import {selectStudioId, setRoles} from '../../../redux/studio'; import {selectStudioId, setRoles, setInfo} from '../../../redux/studio';
const Errors = keyMirror({ const Errors = keyMirror({
NETWORK: null, NETWORK: null,
...@@ -85,6 +85,7 @@ const removeManager = username => ((dispatch, getState) => new Promise((resolve, ...@@ -85,6 +85,7 @@ const removeManager = username => ((dispatch, getState) => new Promise((resolve,
if (selectUsername(state) === username) { if (selectUsername(state) === username) {
dispatch(setRoles({manager: false})); dispatch(setRoles({manager: false}));
} }
dispatch(setInfo({managers: state.studio.managers - 1}));
return resolve(); return resolve();
}); });
})); }));
...@@ -147,6 +148,7 @@ const promoteCurator = username => ((dispatch, getState) => new Promise((resolve ...@@ -147,6 +148,7 @@ const promoteCurator = username => ((dispatch, getState) => new Promise((resolve
const curatorItem = curatorList[index]; const curatorItem = curatorList[index];
if (index !== -1) dispatch(curators.actions.remove(index)); if (index !== -1) dispatch(curators.actions.remove(index));
dispatch(managers.actions.create(curatorItem, true)); dispatch(managers.actions.create(curatorItem, true));
dispatch(setInfo({managers: state.studio.managers + 1}));
return resolve(); return resolve();
}); });
})); }));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment