This commit is contained in:
XYenon 2023-08-02 19:15:40 +08:00 committed by GitHub
commit 3503abdb6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -83,6 +83,16 @@ class DownloadComponent extends Component {
continue: true,
};
deleteFinished = (index) => {
return () => {
this.setState({
finishedList: this.state.finishedList.filter((_, itemIndex) => {
return index !== itemIndex;
})
});
};
};
componentDidMount = () => {
this.loadDownloading();
};
@ -203,7 +213,11 @@ class DownloadComponent extends Component {
)}
{this.state.finishedList.map((value, k) => {
if (value.files) {
return <FinishedCard key={k} task={value} />;
return <FinishedCard
key={k}
task={value}
deleteSelf={this.deleteFinished(k)}
/>;
}
return null;
})}

View File

@ -201,7 +201,7 @@ export default function FinishedCard(props) {
ToggleSnackbar("top", "right", error.message, "error");
})
.then(() => {
window.location.reload();
props.deleteSelf();
});
};