From 4371804429d7843677fd017ac81042bfe3cd4423 Mon Sep 17 00:00:00 2001 From: Scald <104459145+Arikatsu@users.noreply.github.com> Date: Fri, 26 Aug 2022 21:15:04 +0530 Subject: [PATCH] Update download.ts --- src/utils/download.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/utils/download.ts b/src/utils/download.ts index 2784bf5..87e6495 100644 --- a/src/utils/download.ts +++ b/src/utils/download.ts @@ -77,17 +77,20 @@ export default class DownloadHandler { // Extraction events listen('extract_start', ({ payload }) => { - // Find the download that is no extracting and set it's status as such - // @ts-expect-error Too lazy to make an interface for payloads rn - const index = this.downloads.findIndex((download) => download.path === payload.file) + // Find the download that is extracting and set it's status as such + const index = this.downloads.findIndex((download) => download.path === payload) this.downloads[index].status = 'extracting' }) listen('extract_end', ({ payload }) => { - console.log(payload) - // Find the download that is no extracting and set it's status as such - // @ts-expect-error Too lazy to make an interface for payloads rn - const index = this.downloads.findIndex((download) => download.path === payload.file) + // @ts-expect-error shut up typescript + const obj: { + file: string + new_folder: string + } = payload + + // Find the download that is not extracting and set it's status as such + const index = this.downloads.findIndex((download) => download.path === obj.file || obj.new_folder) this.downloads[index].status = 'finished' }) }