Commit 4bfb7be6 authored by Phạm Quang Bảo's avatar Phạm Quang Bảo

fix: rename middleware auth

parent e657aea5
import { login } from "#middlewares/authentication";
import { authenticate } from "#middlewares/authentication";
import { AuthService } from "#services/authService";
import { Application } from "express";
import { Resource } from "express-automatic-routes";
......@@ -24,7 +24,7 @@ export default (_express: Application) => {
* $ref: "#/components/schemas/logoutResponse"
*/
post: {
middleware: [login],
middleware: [authenticate],
handler: async (req, res) => {
try {
......
import { login } from "#middlewares/authentication";
import { authenticate } from "#middlewares/authentication";
import { AuthService } from "#services/authService";
import { Application } from "express";
import { Resource } from "express-automatic-routes";
......@@ -24,7 +24,7 @@ export default (_express: Application) => {
* $ref: "#/components/schemas/Profile"
*/
get: {
middleware: [login],
middleware: [authenticate],
handler: async (req, res) => {
try {
......
import { login } from "#middlewares/authentication";
import { authenticate } from "#middlewares/authentication";
import { AuthService } from "#services/authService.js";
import { MailService } from "#services/mailService.js";
import { Application } from "express";
......@@ -28,7 +28,7 @@ export default (_express: Application) => {
* $ref: "#/components/schemas/sendOtpResponse"
*/
post: {
middleware: [login],
middleware: [authenticate],
handler: async (req, res) => {
try {
......
import { login } from "#middlewares/authentication";
import { authenticate } from "#middlewares/authentication";
import { AuthService } from "#services/authService.js";
import { Application } from "express";
import { Resource } from "express-automatic-routes";
......@@ -32,7 +32,7 @@ export default (_express: Application) => {
* $ref: "#/components/schemas/verifyOtpResponse"
*/
post: {
middleware: [login],
middleware: [authenticate],
handler: async (req, res) => {
try {
......
......@@ -4,7 +4,7 @@ import { Response, NextFunction } from 'express';
//demo
const JWT_SECRET = process.env.JWT_SECRET || '';
export const login = (req: any, res: Response, next: NextFunction) => {
export const authenticate = (req: any, res: Response, next: NextFunction) => {
const authHeader = req.headers.authorization;
if (!authHeader || !authHeader.startsWith('Bearer ')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment