fixing: get product

This commit is contained in:
ilham
2021-12-14 21:48:21 +07:00
parent ff60406af2
commit 6f1f82cc03
11 changed files with 198 additions and 36 deletions

View File

@@ -28,7 +28,7 @@ export class AuthService {
username: user.username,
sub: user.id,
role: user.roles.name,
partner: user.partner.id,
partner: user.partner?.id,
};
return {

View File

@@ -1,7 +1,7 @@
import { ExtractJwt, Strategy } from 'passport-jwt';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable } from '@nestjs/common';
import {ConfigService} from "@nestjs/config";
import { ConfigService } from '@nestjs/config';
@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
@@ -14,6 +14,9 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
}
async validate(payload: any) {
return { userId: payload.sub, username: payload.username };
return {
userId: payload.sub,
username: payload.username,
};
}
}