refactor: refactored gql-user-decorator to work for subscriptions
This commit is contained in:
@@ -4,7 +4,7 @@ import { GqlExecutionContext } from '@nestjs/graphql';
|
||||
export const GqlUser = createParamDecorator(
|
||||
(data: unknown, context: ExecutionContext) => {
|
||||
const ctx = GqlExecutionContext.create(context);
|
||||
return ctx.getContext().req.user;
|
||||
const { req, headers } = ctx.getContext();
|
||||
return headers ? headers.user : req.user;
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user