Ensure callback is provided before calling callback

pull/5370/head
ioedeveloper 3 years ago
parent 0c4104a2bd
commit dc7b8dd712
  1. 6
      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)
})
})

Loading…
Cancel
Save