Update configuration service pour le logout (suppression des cookies)
This commit is contained in:
parent
d6202efbbf
commit
6c52142c2e
@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
|
"serverAddress": "localhost",
|
||||||
"apiURL": "http://localhost:8080/api"
|
"apiURL": "http://localhost:8080/api"
|
||||||
}
|
}
|
||||||
|
@ -9,4 +9,8 @@ export class ConfigurationService {
|
|||||||
getApiUrl(): string {
|
getApiUrl(): string {
|
||||||
return config.apiURL
|
return config.apiURL
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getServerAddress(): string {
|
||||||
|
return config.serverAddress
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ import {CookieService} from 'ngx-cookie-service';
|
|||||||
import {HeaderComponent} from '../../components/header/header.component';
|
import {HeaderComponent} from '../../components/header/header.component';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
import {MessageService} from 'primeng/api';
|
import {MessageService} from 'primeng/api';
|
||||||
|
import {ConfigurationService} from '../../configuration.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-logout',
|
selector: 'app-logout',
|
||||||
@ -17,11 +18,11 @@ export class LogoutComponent implements OnInit{
|
|||||||
|
|
||||||
constructor(private cookiesService: CookieService,
|
constructor(private cookiesService: CookieService,
|
||||||
private messageService: MessageService,
|
private messageService: MessageService,
|
||||||
private router: Router) { }
|
private router: Router,
|
||||||
|
private configurationService: ConfigurationService,) { }
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// this.cookiesService.deleteAll("/", "localhost"); // deleteAll est bugué
|
this.cookiesService.delete('author', '/', this.configurationService.getServerAddress())
|
||||||
this.cookiesService.delete('author', '/', 'localhost')
|
this.cookiesService.delete('token', '/', this.configurationService.getServerAddress())
|
||||||
this.cookiesService.delete('token', '/', 'localhost')
|
|
||||||
this.router.navigate(['/']).then(() => this.successMessage('Déconnexion', 'Vous avez été deconnecté avec succès'));
|
this.router.navigate(['/']).then(() => this.successMessage('Déconnexion', 'Vous avez été deconnecté avec succès'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user