forked from Ynov/ptitspas-ynov-back
added logout to controller
This commit is contained in:
parent
753237ee83
commit
f5ba267f78
@ -9,6 +9,8 @@ import type { Request } from 'express';
|
|||||||
import { UserService } from '../user/user.service';
|
import { UserService } from '../user/user.service';
|
||||||
import { ProfileResponseDto } from './dto/profile_response.dto';
|
import { ProfileResponseDto } from './dto/profile_response.dto';
|
||||||
import { RefreshTokenDto } from './dto/refresh_token.dto';
|
import { RefreshTokenDto } from './dto/refresh_token.dto';
|
||||||
|
import { User } from 'src/common/decorators/user.decorator';
|
||||||
|
import { Users } from 'src/entities/users.entity';
|
||||||
|
|
||||||
@ApiTags('Authentification')
|
@ApiTags('Authentification')
|
||||||
@Controller('auth')
|
@Controller('auth')
|
||||||
@ -62,5 +64,11 @@ export class AuthController {
|
|||||||
statut: user.statut,
|
statut: user.statut,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UseGuards(AuthGuard)
|
||||||
|
@Post('logout')
|
||||||
|
logout(@User() currentUser: Users) {
|
||||||
|
return this.authService.logout(currentUser.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import { RegisterDto } from './dto/register.dto';
|
|||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { RoleType, StatutUtilisateurType, Users } from 'src/entities/users.entity';
|
import { RoleType, StatutUtilisateurType, Users } from 'src/entities/users.entity';
|
||||||
import { LoginDto } from './dto/login.dto';
|
import { LoginDto } from './dto/login.dto';
|
||||||
import { DeepPartial } from 'typeorm';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
@ -131,6 +130,8 @@ export class AuthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async logout(userId: string) {
|
async logout(userId: string) {
|
||||||
// Pour une implémentation simple, on ne fait rien ici.
|
// Pour le moment envoyer un message clair
|
||||||
|
return { success: true, message: 'Deconnexion'}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user