update
This commit is contained in:
@@ -11,6 +11,7 @@ export enum AuthEntityType {
|
||||
export interface AuthRequest extends Request {
|
||||
user: {
|
||||
sub: string; // userId
|
||||
slug: string;
|
||||
};
|
||||
}
|
||||
export interface JwtPayload {
|
||||
@@ -42,8 +43,6 @@ export class AuthGuard implements CanActivate {
|
||||
if (payload.type !== AuthEntityType.USER) {
|
||||
throw new UnauthorizedException('Access denied. User rights required.');
|
||||
}
|
||||
// 💡 We're assigning the payload to the request object here
|
||||
// so that we can access it in our route handlers
|
||||
request['user'] = payload;
|
||||
} catch {
|
||||
throw new UnauthorizedException();
|
||||
|
||||
Reference in New Issue
Block a user