Skip to content

Commit

Permalink
go back to P.then() :/ ..
Browse files Browse the repository at this point in the history
  • Loading branch information
3imed-jaberi committed May 27, 2020
1 parent 99df037 commit 6e9f43e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function makePromise(multer, name) {
multer[name] = function() {
const middleware = Reflect.apply(fn, this, arguments);

return async (ctx, next) => {
await new Promise((resolve, reject) => {
return (ctx, next) => {
return new Promise((resolve, reject) => {
middleware(ctx.req, ctx.res, err => {
if (err) return reject(err);
if ('request' in ctx) {
Expand All @@ -58,9 +58,7 @@ function makePromise(multer, name) {

resolve(ctx);
});
});

return next;
}).then(next); // eslint-disable-line promise/prefer-await-to-then
};
};
}
Expand Down

0 comments on commit 6e9f43e

Please sign in to comment.