obj
This commit is contained in:
@@ -2,7 +2,7 @@ const formidable = require('formidable');
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
async parseForm (req, config) {
|
async parseForm (req, config) {
|
||||||
if (!req) return null;
|
if (!req) return {};
|
||||||
const form = new formidable.IncomingForm();
|
const form = new formidable.IncomingForm();
|
||||||
Object.assign(form, config);
|
Object.assign(form, config);
|
||||||
form.on('fileBegin', function (name, file) {
|
form.on('fileBegin', function (name, file) {
|
||||||
@@ -14,7 +14,7 @@ module.exports = {
|
|||||||
};
|
};
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
form.parse(req, function (err, fields, data) {
|
form.parse(req, function (err, fields, data) {
|
||||||
if (err) return reject(err);
|
if (err) return reject({});
|
||||||
else return resolve({ fields, data });
|
else return resolve({ fields, data });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user