Web: Files: versionHistory: added action restoreVersion

This commit is contained in:
Artem Tarasov 2020-12-23 16:54:12 +03:00
parent 6498cd542e
commit b15e6db9cc
2 changed files with 11 additions and 1 deletions

View File

@ -1603,3 +1603,14 @@ export function markAsVersion(id, isVersion, version) {
.then((versions) => dispatch(setFileVersions(versions)));
};
}
export function restoreVersion(id, version) {
return (dispatch, getState) => {
return api.files.versionRestore(id, version).then((newVersion) => {
const state = getState();
const versions = getFileVersions(state);
versions.unshift(newVersion);
dispatch(setFileVersions(versions));
});
};
}

View File

@ -585,7 +585,6 @@ const filesReducer = (state = initialState, action) => {
},
});
}
case SET_FILE_VERSIONS: {
return Object.assign({}, state, {
versionHistory: {