1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-18 00:00:00 +00:00

feat: optimzie code

This commit is contained in:
er-pai-r
2023-12-09 17:39:43 +08:00
parent 9e8c95b9b1
commit 3c9f715269
3 changed files with 23 additions and 6 deletions

View File

@@ -48,14 +48,14 @@ class SdocFileHistory extends React.Component {
};
}
onSelectHistoryVersion = (currentVersion, isShowChanges) => {
onSelectHistoryVersion = (currentVersion, lastVersion) => {
this.setState({ isLoading: true, currentVersion });
seafileAPI.getFileRevision(historyRepoID, currentVersion.commit_id, currentVersion.path).then(res => {
return seafileAPI.getFileContent(res.data);
}).then(res => {
const currentVersionContent = res.data;
if (isShowChanges) {
seafileAPI.getLastFileRevision(historyRepoID, currentVersion.id, currentVersion.path).then(res => {
if (lastVersion) {
seafileAPI.getFileRevision(historyRepoID, lastVersion.commit_id, lastVersion.path).then(res => {
return res.data ? seafileAPI.getFileContent(res.data) : { data: '' };
}).then(res => {
const lastVersionContent = res.data;