mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-27 01:25:52 -05:00
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:
parent
3a03f10aff
commit
f8d598549d
1 changed files with 10 additions and 1 deletions
|
@ -55,6 +55,10 @@ module.exports.previewReducer = (state, action) => {
|
|||
projectInfo: action.info ? action.info : {},
|
||||
projectNotAvailable: !action.info
|
||||
});
|
||||
case 'UPDATE_PROJECT_INFO':
|
||||
return Object.assign({}, state, {
|
||||
projectInfo: Object.assign({}, state.projectInfo, action.info)
|
||||
});
|
||||
case 'SET_REMIXES':
|
||||
return Object.assign({}, state, {
|
||||
remixes: action.items
|
||||
|
@ -182,6 +186,11 @@ module.exports.setProjectInfo = info => ({
|
|||
info: info
|
||||
});
|
||||
|
||||
module.exports.updateProjectInfo = info => ({
|
||||
type: 'UPDATE_PROJECT_INFO',
|
||||
info: info
|
||||
});
|
||||
|
||||
module.exports.setOriginalInfo = info => ({
|
||||
type: 'SET_ORIGINAL',
|
||||
info: info
|
||||
|
@ -785,7 +794,7 @@ module.exports.shareProject = (projectId, token) => (dispatch => {
|
|||
return;
|
||||
}
|
||||
dispatch(module.exports.setFetchStatus('project', module.exports.Status.FETCHED));
|
||||
dispatch(module.exports.setProjectInfo(body));
|
||||
dispatch(module.exports.updateProjectInfo(body));
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue