refactor(helpers/authentication): remove obsolete arguments in isAuthenticated

This commit is contained in:
Ali BARIN
2024-09-30 12:04:37 +00:00
parent 0b7591edce
commit de42eda65f

View File

@@ -1,7 +1,7 @@
import User from '../models/user.js';
import AccessToken from '../models/access-token.js';
export const isAuthenticated = async (_parent, _args, req) => {
export const isAuthenticated = async (req) => {
const token = req.headers['authorization'];
if (token == null) return false;
@@ -40,7 +40,7 @@ export const isAuthenticated = async (_parent, _args, req) => {
};
export const authenticateUser = async (request, response, next) => {
if (await isAuthenticated(null, null, request)) {
if (await isAuthenticated(request)) {
next();
} else {
return response.status(401).end();