import { NextFunction , Request , Response } from 'express' ; import ErrorResponse from '@/utils/errorResponse' ; import { commonError } from '@/constants/error' ; import { Token } from '@/helper/jwt' ; const verifyTokenSub = ( sub ) => ( req , _res , next ) => { if ( req . token . sub === sub ) { return next ( ) ; } return next ( new ErrorResponse ( commonError . unauthorized ) ) ; } ; error need export const isRefreshToken = verifyTokenSub ( Token . Refresh ) ; error need export const isAccessToken = verifyTokenSub ( Token . Access ) ;