🐛 fix: NeedAuth bug
This commit is contained in:
parent
a863806111
commit
5bbefbcf4a
@ -13,5 +13,5 @@ export function NeedAuth(needAuth = true) {
|
||||
ApiUnauthorizedResponse({ description: 'Unauthorized' }),
|
||||
)
|
||||
}
|
||||
return new Function()
|
||||
return applyDecorators(SetMetadata(NEED_AUTH_KEY, needAuth))
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ export class JwtAuthGuard extends AuthGuard('jwt') {
|
||||
|
||||
canActivate(context: ExecutionContext) {
|
||||
const needAuth = this.reflector.getAllAndOverride<boolean>(NEED_AUTH_KEY, [
|
||||
context.getClass(),
|
||||
context.getHandler(),
|
||||
context.getClass(),
|
||||
])
|
||||
if (needAuth) {
|
||||
return super.canActivate(context)
|
||||
|
Loading…
Reference in New Issue
Block a user