Skip to content

Commit

Permalink
style: format code with Autopep8, Black, ClangFormat, dotnet-format, …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
deepsource-autofix[bot] authored May 10, 2024
1 parent 6689b93 commit a24ae6c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/middleware/auth.js
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a24ae6c

Please sign in to comment.