mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 08:34:55 +00:00
12 lines
286 B
TypeScript
12 lines
286 B
TypeScript
import { UnauthorizedException } from '@nestjs/common';
|
|
import { AuthGuard } from '@nestjs/passport';
|
|
|
|
export class JwtAuthGuard extends AuthGuard('jwt') {
|
|
handleRequest(err, user) {
|
|
if (err || !user) {
|
|
throw err || new UnauthorizedException();
|
|
}
|
|
return user;
|
|
}
|
|
}
|