Skip to content

Commit a8e51b4

Browse files
committed
fix: name verify access token
1 parent 15d9b85 commit a8e51b4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/controllers/Auth/controller.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Request, Response } from 'express'
22
import routes from 'routes/public'
33
import asyncHandler from 'helpers/asyncHandler'
4-
import { currentToken, verifyToken } from 'helpers/Token'
4+
import { currentToken, verifyAccessToken } from 'helpers/Token'
55
import Authorization from 'middlewares/Authorization'
66
import BuildResponse from 'modules/Response/BuildResponse'
77
import RefreshTokenService from 'controllers/RefreshToken/service'
@@ -62,7 +62,7 @@ routes.get(
6262
Authorization,
6363
asyncHandler(async function getProfile(req: Request, res: Response) {
6464
const getToken = currentToken(req)
65-
const token = verifyToken(getToken)
65+
const token = verifyAccessToken(getToken)
6666

6767
// @ts-ignore
6868
const data = await AuthService.profile(token)

src/helpers/Token.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function currentToken(req: Request) {
5252
*
5353
* @param token - Verify Token
5454
*/
55-
function verifyToken(token: string) {
55+
function verifyAccessToken(token: string) {
5656
try {
5757
if (!token) {
5858
return { data: null, message: 'Unauthorized!' }
@@ -102,4 +102,4 @@ function verifyRefreshToken(token: string) {
102102
}
103103
}
104104

105-
export { getToken, currentToken, verifyToken, verifyRefreshToken }
105+
export { getToken, currentToken, verifyAccessToken, verifyRefreshToken }

src/middlewares/Authorization.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { NextFunction, Request, Response } from 'express'
2-
import { currentToken, verifyToken } from 'helpers/Token'
2+
import { currentToken, verifyAccessToken } from 'helpers/Token'
33
import { isEmpty } from 'lodash'
44

55
async function Authorization(req: Request, res: Response, next: NextFunction) {
66
const getToken = currentToken(req)
7-
const token = verifyToken(getToken)
7+
const token = verifyAccessToken(getToken)
88

99
if (isEmpty(token?.data)) {
1010
return res.status(401).json({

0 commit comments

Comments
 (0)