Update instead of replacing project info to match API.

The API endpoint will return just the updated slice of the projectInfo, so just update the projectInfo instead of replacing.
This commit is contained in:
Paul Kaplan 2018-11-13 12:23:05 -05:00
parent 3a03f10aff
commit f8d598549d

View file

@ -55,6 +55,10 @@ module.exports.previewReducer = (state, action) => {
projectInfo: action.info ? action.info : {}, projectInfo: action.info ? action.info : {},
projectNotAvailable: !action.info projectNotAvailable: !action.info
}); });
case 'UPDATE_PROJECT_INFO':
return Object.assign({}, state, {
projectInfo: Object.assign({}, state.projectInfo, action.info)
});
case 'SET_REMIXES': case 'SET_REMIXES':
return Object.assign({}, state, { return Object.assign({}, state, {
remixes: action.items remixes: action.items
@ -182,6 +186,11 @@ module.exports.setProjectInfo = info => ({
info: info info: info
}); });
module.exports.updateProjectInfo = info => ({
type: 'UPDATE_PROJECT_INFO',
info: info
});
module.exports.setOriginalInfo = info => ({ module.exports.setOriginalInfo = info => ({
type: 'SET_ORIGINAL', type: 'SET_ORIGINAL',
info: info info: info
@ -785,7 +794,7 @@ module.exports.shareProject = (projectId, token) => (dispatch => {
return; return;
} }
dispatch(module.exports.setFetchStatus('project', module.exports.Status.FETCHED)); dispatch(module.exports.setFetchStatus('project', module.exports.Status.FETCHED));
dispatch(module.exports.setProjectInfo(body)); dispatch(module.exports.updateProjectInfo(body));
}); });
}); });