From 2321ea6077c421170816fb560d7419d8a2ba6419 Mon Sep 17 00:00:00 2001 From: Bhaskara Kishore Date: Fri, 10 Mar 2023 17:29:23 +0530 Subject: [PATCH] logout --- src/controllers/userController.js | 9 ------- src/routes/usersRoute.js | 45 ++++++++++++++----------------- 2 files changed, 20 insertions(+), 34 deletions(-) diff --git a/src/controllers/userController.js b/src/controllers/userController.js index c0abc9c7..b1533634 100644 --- a/src/controllers/userController.js +++ b/src/controllers/userController.js @@ -369,18 +369,9 @@ exports.uploadProfilePicture = async (req, reply) => { exports.logout = async (request, reply) => { - // const blacklist = new Set(); const invalidatedTokens = {}; const accessToken = request.headers.authorization && request.body.access_token; - // console.log(accessToken) - - // Add the access token to the blacklist - // blacklist.add(accessToken); - // console.log(blacklist.add(accessToken)) - invalidatedTokens[accessToken] = true; - // console.log(invalidatedTokens[accessToken] = true) - reply.send({ message: 'Logout successful' }) } diff --git a/src/routes/usersRoute.js b/src/routes/usersRoute.js index 02b7c017..98c2eb0b 100644 --- a/src/routes/usersRoute.js +++ b/src/routes/usersRoute.js @@ -414,31 +414,6 @@ module.exports = function (fastify, opts, next) { }); - fastify.route({ - method: "DELETE", - url: "/api/logout", - schema: { - description: "This is for logout", - tags: ["Logout"], - summary: "This is for logout", - params: { - type: "object", - properties: { - customerId: { - type: "string", - description: "customerId", - }, - }, - }, - }, - // preHandler: fastify.auth([fastify.authenticate]), - handler: userController.logout, - // onResponse: (request,reply) => {validationHandler.resetPassword(request,reply)} - }); - - - - fastify.route({ method: "POST", url: "/api/sendSms", @@ -465,6 +440,26 @@ module.exports = function (fastify, opts, next) { // onResponse: (request,reply) => {validationHandler.resetPassword(request,reply)} }); + fastify.route({ + method: "DELETE", + url: "/api/logout", + schema: { + description: "This is for logout", + tags: ["Logout"], + summary: "This is for logout", + params: { + type: "object", + properties: { + customerId: { + type: "string", + description: "customerId", + }, + }, + }, + }, + // preHandler: fastify.auth([fastify.authenticate]), + handler: userController.logout, + }); next();