mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 08:04:52 +01:00
fix download progress
This commit is contained in:
@@ -32,9 +32,9 @@ export default class ProgressBar extends React.Component<IProps, IState> {
|
||||
const intv = setInterval(() => {
|
||||
const prog = this.props.downloadManager.getTotalAverage()
|
||||
this.setState({
|
||||
average: parseInt(prog?.avergae || 0, 10),
|
||||
average: parseInt(prog?.average || 0, 10),
|
||||
files: prog?.files,
|
||||
total: prog?.total || 0,
|
||||
total: prog?.totalSize || 0,
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
|
||||
@@ -17,13 +17,14 @@ export default class DownloadHandler {
|
||||
listen('download_progress', (...payload) => {
|
||||
// @ts-expect-error Payload may be unknown but backend always returns this object
|
||||
const obj: {
|
||||
downloaded: number,
|
||||
total: number,
|
||||
downloaded: string,
|
||||
total: string,
|
||||
path: string,
|
||||
} = payload[0].payload
|
||||
|
||||
const index = this.downloads.findIndex(download => download.path === obj.path)
|
||||
this.downloads[index].progress = obj.downloaded
|
||||
this.downloads[index].progress = parseInt(obj.downloaded, 10)
|
||||
this.downloads[index].total = parseInt(obj.total, 10)
|
||||
})
|
||||
|
||||
listen('download_finished', (...payload) => {
|
||||
|
||||
Reference in New Issue
Block a user