From 6a6815da111dd6c8805f62aa2d1cf21b62695d29 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Thu, 14 Oct 2021 20:57:10 +0100 Subject: [PATCH] Ensure callback is provided before calling callback --- libs/remix-ui/workspace/src/lib/actions/workspace.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/remix-ui/workspace/src/lib/actions/workspace.ts b/libs/remix-ui/workspace/src/lib/actions/workspace.ts index e97da3ce3a..3bffd303c4 100644 --- a/libs/remix-ui/workspace/src/lib/actions/workspace.ts +++ b/libs/remix-ui/workspace/src/lib/actions/workspace.ts @@ -26,7 +26,7 @@ export const addInputField = async (type: 'file' | 'folder', path: string, cb?: return reject(error) } - cb(null, true) + cb && cb(null, true) resolve(fileTree) }) }) @@ -237,7 +237,7 @@ export const uploadFile = async (target, targetFolder: string, cb?: (err: Error, } } fileReader.readAsText(file) - cb(null, true) + cb && cb(null, true) } const name = `${targetFolder}/${file.name}` @@ -250,7 +250,7 @@ export const uploadFile = async (target, targetFolder: string, cb?: (err: Error, }, () => {})) } }).catch(error => { - cb(error) + cb && cb(error) if (error) console.log(error) }) })