cambios en el crear producto y en el refresh token

This commit is contained in:
2025-08-14 15:38:10 -04:00
parent 854b31f594
commit 6a28e141a9
19 changed files with 278 additions and 400 deletions

View File

@@ -43,7 +43,14 @@ export class JwtRefreshGuard implements CanActivate {
}
private extractTokenFromHeader(request: Request): string | undefined {
const [type, token] = request.headers.authorization?.split(' ') ?? [];
return type === 'Bearer' ? token : undefined;
const token = request.body.token
console.log(token);
if (token) {
return token;
}
// console.log(request.headers.authorization);
// const [type, token] = request.headers.authorization?.split(' ') ?? [];
// return type === 'Bearer' ? token : undefined;
}
}

View File

@@ -11,6 +11,7 @@ import {
HttpCode,
Patch,
Post,
Req,
UseGuards,
} from '@nestjs/common';
import { AuthService } from './auth.service';
@@ -51,13 +52,18 @@ export class AuthController {
// }
@UseGuards(JwtRefreshGuard)
@Patch('refresh-token')
@Public()
@HttpCode(200)
@Patch('refresh')
//@RequirePermissions('auth:refresh-token')
async refreshToken(@Body() refreshTokenDto: RefreshTokenDto) {
console.log("Refrescando token...");
console.log(refreshTokenDto);
async refreshToken(@Req() req: Request,@Body() refreshTokenDto: RefreshTokenDto) {
console.log("Pepe");
console.log(req['user']);
//console.log(refreshTokenDto);
return await this.authService.refreshToken(refreshTokenDto);
return null
// return await this.authService.refreshToken(refreshTokenDto);
}
// @Public()

View File

@@ -8,7 +8,7 @@ export class RefreshTokenDto {
})
refresh_token: string;
@ApiProperty()
@IsNumber()
user_id: number;
// @ApiProperty()
// @IsNumber()
// user_id: number;
}