Created
December 7, 2022 14:07
-
-
Save p32929/9e2936fc65de89d7cc286e580e1ca59d to your computer and use it in GitHub Desktop.
GetUser.Decorator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import { User } from '@interfaces/user.interface'; | |
import { User } from '@interfaces/user.interface'; | |
import { createParamDecorator, ExecutionContext } from '@nestjs/common'; | |
export const GetUser = createParamDecorator( | |
(data, ctx: ExecutionContext): User => { | |
const req = ctx.switchToHttp().getRequest(); | |
return req.user; | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment