controller refresh token dto applied
This commit is contained in:
parent
0982f81dba
commit
18945edb51
@ -8,6 +8,7 @@ import { AuthGuard } from 'src/common/guards/auth.guard';
|
||||
import type { Request } from 'express';
|
||||
import { UserService } from '../user/user.service';
|
||||
import { ProfileResponseDto } from '../user/dto/profile_response.dto';
|
||||
import { RefreshTokenDto } from '../user/dto/refresh_token.dto';
|
||||
|
||||
@ApiTags('Authentification')
|
||||
@Controller('auth')
|
||||
@ -34,9 +35,12 @@ export class AuthController {
|
||||
|
||||
@Public()
|
||||
@Post('refresh')
|
||||
@ApiBearerAuth('refresh_token')
|
||||
@ApiResponse({ status: 200, description: 'Nouveaux tokens générés avec succès.' })
|
||||
@ApiResponse({ status: 401, description: 'Token de rafraîchissement invalide ou expiré.' })
|
||||
@ApiOperation({ summary: 'Rafraichir les tokens' })
|
||||
async refresh(@Body('refresh_token') refreshToken: string) {
|
||||
return this.authService.refreshTokens(refreshToken);
|
||||
async refresh(@Body() dto: RefreshTokenDto) {
|
||||
return this.authService.refreshTokens(dto.refresh_token);
|
||||
}
|
||||
|
||||
@Get('me')
|
||||
@ -48,7 +52,6 @@ export class AuthController {
|
||||
if (!req.user || !req.user.sub) {
|
||||
throw new UnauthorizedException('Utilisateur non authentifié');
|
||||
}
|
||||
|
||||
const user = await this.userService.findOne(req.user.sub);
|
||||
return {
|
||||
id: user.id,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user