Refactored Auth with Sessions #12
|
@ -48,9 +48,13 @@ export class AuthController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiCreatedResponse({
|
||||||
|
description: 'User signed out',
|
||||||
|
})
|
||||||
|
@HttpCode(HttpStatus.OK)
|
||||||
@UseGuards(SessionGuard)
|
@UseGuards(SessionGuard)
|
||||||
@Post('logout')
|
@Post('logout')
|
||||||
public async logout(@Req() request: Request): Promise<void> {
|
public async logout(@Req() request: Request): Promise<{ success: boolean }> {
|
||||||
this.authService.logout(request.sessionID);
|
return this.authService.logout(request.sessionID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,9 +119,10 @@ export class AuthService {
|
||||||
return responseData;
|
return responseData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async logout(sessionId: string): Promise<void> {
|
public async logout(sessionId: string): Promise<{ success: boolean }> {
|
||||||
try {
|
try {
|
||||||
this.sessionService.deleteSessionBySessionId(sessionId);
|
this.sessionService.deleteSessionBySessionId(sessionId);
|
||||||
|
return { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
'Fehler beim Logout',
|
'Fehler beim Logout',
|
||||||
|
|
Loading…
Reference in New Issue