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.
getRequestToken
1 parent 730f242 commit f3cd77aCopy full SHA for f3cd77a
server/src/lib/GetRequestUser.ts
@@ -4,13 +4,17 @@ import {
4
HttpStatus,
5
createParamDecorator,
6
} from '@nestjs/common';
7
+import type { Request } from 'express';
8
9
import type { UserDocument } from '@server/user/entity/user.entity';
10
11
export const GetRequestToken = createParamDecorator(
12
(data: unknown, ctx: ExecutionContext) => {
- const req = ctx.switchToHttp().getRequest();
13
- const user = req.existingUser as UserDocument;
+ const req = ctx
14
+ .switchToHttp()
15
+ .getRequest<Request & { existingUser: UserDocument }>();
16
+
17
+ const user = req.existingUser;
18
19
return user;
20
},
0 commit comments