From 45645fe630c681defb84c60203b395f6ee479811 Mon Sep 17 00:00:00 2001 From: Xmader Date: Mon, 9 Nov 2020 14:10:01 -0500 Subject: [PATCH] refactor: auth magic --- src/file.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/file.ts b/src/file.ts index 6be081d..dd3b7e5 100644 --- a/src/file.ts +++ b/src/file.ts @@ -22,7 +22,7 @@ let magic: Promise | string = new Promise((resolve) => { const fn = r.a t.d(r, 'a', () => { return (...args) => { - if (typeof magic !== 'string') { + if (magic instanceof Promise) { magic = args[MAGIC_ARG_INDEX] resolve(magic) } @@ -48,7 +48,7 @@ export const getFileUrl = async (type: FileType, index = 0): Promise => const fn: (id: number, index: number, cb: (url: string) => any, magic: string) => string = fileUrlModule.a - if (typeof magic !== 'string') { + if (magic instanceof Promise) { // force to retrieve the MAGIC const el = document.querySelectorAll('.SD7H- > button')[3] as HTMLButtonElement el.click()