Skip to content

Commit d8f017f

Browse files
committed
✨ feat: payload 접근시 사용할 데코레이터 생성
1 parent 900300f commit d8f017f

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './current-user.decorator';

0 commit comments

Comments
 (0)