1+ import { NextFunction , Request , Response } from 'express' ;
12import { StatusCodes } from 'http-status-codes' ;
2- import { Request , Response , NextFunction } from 'express' ;
33
44import config from '../config/config' ;
55import JWTPayload from '../domain/misc/JWTPayload' ;
66import * as authService from '../services/authService' ;
77
88const { messages } = config ;
99
10- /**
11- * Handle /login request.
12- *
13- * @param {Request } req
14- * @param {Response } res
15- * @param {NextFunction } next
16- */
17- export async function login (
18- req : Request ,
19- res : Response ,
20- next : NextFunction
21- ) : Promise < void > {
10+ export const login = async ( req : Request , res : Response , next : NextFunction ) : Promise < void > => {
2211 try {
2312 const data = await authService . login ( req . body ) ;
2413
@@ -30,20 +19,9 @@ export async function login(
3019 } catch ( error ) {
3120 next ( error ) ;
3221 }
33- }
22+ } ;
3423
35- /**
36- * Handle /refresh request.
37- *
38- * @param {Request } req
39- * @param {Response } res
40- * @param {NextFunction } next
41- */
42- export async function refresh (
43- _ : Request ,
44- res : Response ,
45- next : NextFunction
46- ) : Promise < void > {
24+ export const refresh = async ( _ : Request , res : Response , next : NextFunction ) : Promise < void > => {
4725 try {
4826 const token = String ( res . locals . refreshToken ) ;
4927 const jwtPayload = res . locals . jwtPayload as JWTPayload ;
@@ -57,20 +35,9 @@ export async function refresh(
5735 } catch ( error ) {
5836 next ( error ) ;
5937 }
60- }
38+ } ;
6139
62- /**
63- * Handle /logout request.
64- *
65- * @param {Request } req
66- * @param {Response } res
67- * @param {NextFunction } next
68- */
69- export async function logout (
70- _ : Request ,
71- res : Response ,
72- next : NextFunction
73- ) : Promise < void > {
40+ export const logout = async ( _ : Request , res : Response , next : NextFunction ) : Promise < void > => {
7441 try {
7542 const token = String ( res . locals . refreshToken ) ;
7643 await authService . logout ( token ) ;
@@ -82,4 +49,4 @@ export async function logout(
8249 } catch ( error ) {
8350 next ( error ) ;
8451 }
85- }
52+ } ;
0 commit comments