We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 900300f commit d8f017fCopy full SHA for d8f017f
server/src/common/decorator/current-user.decorator.ts
@@ -0,0 +1,9 @@
1
+import { createParamDecorator, ExecutionContext } from '@nestjs/common';
2
+import { Payload } from '../guard/jwt.guard';
3
+
4
+export const CurrentUser = createParamDecorator(
5
+ (data: unknown, ctx: ExecutionContext): Payload | null => {
6
+ const request = ctx.switchToHttp().getRequest();
7
+ return request.user;
8
+ },
9
+);
server/src/common/decorator/index.ts
@@ -0,0 +1 @@
+export * from './current-user.decorator';
0 commit comments