mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-14 16:14:48 +01:00
emit download errors
This commit is contained in:
@@ -8,6 +8,7 @@ export default class DownloadHandler {
|
||||
progress: number,
|
||||
total: number,
|
||||
status: string,
|
||||
error?: string,
|
||||
}[]
|
||||
|
||||
// Pass tauri invoke function
|
||||
@@ -35,6 +36,19 @@ export default class DownloadHandler {
|
||||
const index = this.downloads.findIndex(download => download.path === filename)
|
||||
this.downloads[index].status = 'finished'
|
||||
})
|
||||
|
||||
listen('download_error', (...payload) => {
|
||||
// @ts-expect-error shut up typescript
|
||||
const errorData: {
|
||||
path: string,
|
||||
error: string,
|
||||
} = payload[0]?.payload
|
||||
|
||||
// Set download to error
|
||||
const index = this.downloads.findIndex(download => download.path === errorData.path)
|
||||
this.downloads[index].status = 'error'
|
||||
this.downloads[index].error = errorData.error
|
||||
})
|
||||
}
|
||||
|
||||
getDownloads() {
|
||||
|
||||
Reference in New Issue
Block a user