mirror of
https://github.com/Foltik/Shimapan
synced 2025-01-07 08:42:49 -05:00
Change wrap to only export itself
This commit is contained in:
parent
7441eaaf02
commit
a8acf85052
@ -10,7 +10,7 @@ const passport = require('passport');
|
|||||||
|
|
||||||
const canonicalizeRequest = require('../util/canonicalize').canonicalizeRequest;
|
const canonicalizeRequest = require('../util/canonicalize').canonicalizeRequest;
|
||||||
const requireAuth = require('../util/requireAuth').requireAuth;
|
const requireAuth = require('../util/requireAuth').requireAuth;
|
||||||
const wrap = require('../util/wrap.js').wrap;
|
const wrap = require('../util/wrap.js');
|
||||||
|
|
||||||
// Wraps passport.authenticate to return a promise
|
// Wraps passport.authenticate to return a promise
|
||||||
function authenticate(req, res, next) {
|
function authenticate(req, res, next) {
|
||||||
|
@ -12,7 +12,7 @@ const fileUpload = multer({dest: config.get('Upload.path')}).single('file');
|
|||||||
const fsPromises = require('fs').promises;
|
const fsPromises = require('fs').promises;
|
||||||
|
|
||||||
const requireAuth = require('../util/requireAuth').requireAuth;
|
const requireAuth = require('../util/requireAuth').requireAuth;
|
||||||
const wrap = require('../util/wrap.js').wrap;
|
const wrap = require('../util/wrap.js');
|
||||||
|
|
||||||
const generatedIdExists = async id =>
|
const generatedIdExists = async id =>
|
||||||
await Upload.countDocuments({id: id}) === 1;
|
await Upload.countDocuments({id: id}) === 1;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const Key = require('../models/Key.js');
|
const Key = require('../models/Key.js');
|
||||||
const wrap = require('./wrap.js').wrap;
|
const wrap = require('./wrap.js');
|
||||||
|
|
||||||
const verifyScope = (scope, requiredScope) => scope.indexOf(requiredScope) !== -1;
|
const verifyScope = (scope, requiredScope) => scope.indexOf(requiredScope) !== -1;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
// Wraps an async middleware function to catch promise rejection
|
// Wraps an async middleware function to catch promise rejection
|
||||||
exports.wrap = fn =>
|
const wrap = fn =>
|
||||||
(req, res, next) => Promise.resolve(fn(req, res, next)).catch(next);
|
(req, res, next) => Promise.resolve(fn(req, res, next)).catch(next);
|
||||||
|
|
||||||
|
module.exports = wrap;
|
Loading…
Reference in New Issue
Block a user