From 2604974324d82e68a3601a868051004982d1e581 Mon Sep 17 00:00:00 2001 From: fengkx Date: Sun, 23 Dec 2018 21:39:27 +0800 Subject: [PATCH] import middleware by fileName --- middlewares/index.js | 0 middlewares/{permission.js => isAdmin.js} | 5 +---- 2 files changed, 1 insertion(+), 4 deletions(-) create mode 100644 middlewares/index.js rename middlewares/{permission.js => isAdmin.js} (88%) diff --git a/middlewares/index.js b/middlewares/index.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/middlewares/permission.js b/middlewares/isAdmin.js similarity index 88% rename from middlewares/permission.js rename to middlewares/isAdmin.js index 36f1d4b52d2..fefa5acbba8 100644 --- a/middlewares/permission.js +++ b/middlewares/isAdmin.js @@ -1,6 +1,4 @@ -const pm = {}; - -pm.isAdmin = async (ctx, next) => { +module.exports = async (ctx, next) => { ctx.state.chat = await ctx.getChat(); const chat = ctx.state.chat; if (chat.type !== 'private') { @@ -19,4 +17,3 @@ pm.isAdmin = async (ctx, next) => { await next(); }; -module.exports = pm;