feat: refresh token

This commit is contained in:
Abdalhamid Alhamad
2024-12-19 16:25:39 +03:00
parent ea60ac3d7b
commit 93f5d83825
4 changed files with 35 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import {
EnableBiometricRequestDto,
ForgetPasswordRequestDto,
LoginRequestDto,
RefreshTokenRequestDto,
SendForgetPasswordOtpRequestDto,
SetEmailRequestDto,
setJuniorPasswordRequestDto,
@ -85,6 +86,13 @@ export class AuthController {
return this.authService.setJuniorPasscode(setPasscodeDto);
}
@Post('refresh-token')
@Public()
async refreshToken(@Body() { refreshToken }: RefreshTokenRequestDto) {
const [res, user] = await this.authService.refreshToken(refreshToken);
return ResponseFactory.data(new LoginResponseDto(res, user));
}
@Post('login')
async login(@Body() loginDto: LoginRequestDto, @Headers(DEVICE_ID_HEADER) deviceId: string) {
const [res, user] = await this.authService.login(loginDto, deviceId);