From a24ae6c88fad1cff68e196c712087dc036b429e8 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Fri, 10 May 2024 07:40:03 +0000 Subject: [PATCH] style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf This commit fixes the style issues introduced in 6689b93 according to the output from Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, Ktlint, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf. Details: None --- src/middleware/auth.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/middleware/auth.js b/src/middleware/auth.js index 46ae82670..3c436ec5a 100644 --- a/src/middleware/auth.js +++ b/src/middleware/auth.js @@ -1,20 +1,20 @@ -const jwt = require("jsonwebtoken"); -const User = require("../models/user"); +const jwt = require('jsonwebtoken') +const User = require('../models/user') const authenticate = async (req, res, next) => { - const token = req.header("Authorization")?.split(" ")[1]; + const token = req.header('Authorization')?.split(' ')[1] if (!token) { - return res.status(401).json({ message: "Access Denied" }); + return res.status(401).json({ message: 'Access Denied' }) } try { - const decoded = jwt.verify(token, process.env.JWT_SECRET); - req.user = await User.findById(decoded.user_id); - next(); + const decoded = jwt.verify(token, process.env.JWT_SECRET) + req.user = await User.findById(decoded.user_id) + next() } catch (error) { - res.status(400).json({ message: "Invalid Token" }); + res.status(400).json({ message: 'Invalid Token' }) } -}; +} -module.exports = authenticate; +module.exports = authenticate