make startBackupTask async
This commit is contained in:
@@ -26,12 +26,11 @@ async function list(req, res, next) {
|
||||
next(new HttpSuccess(200, { backups: result }));
|
||||
}
|
||||
|
||||
function startBackup(req, res, next) {
|
||||
backups.startBackupTask(auditSource.fromRequest(req), function (error, taskId) {
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
async function startBackup(req, res, next) {
|
||||
const [error, taskId] = await safe(backups.startBackupTask(auditSource.fromRequest(req)));
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(202, { taskId }));
|
||||
});
|
||||
next(new HttpSuccess(202, { taskId }));
|
||||
}
|
||||
|
||||
async function cleanup(req, res, next) {
|
||||
|
||||
Reference in New Issue
Block a user