diff --git a/configuration.json b/configuration.json index aba0111..a8638a0 100644 --- a/configuration.json +++ b/configuration.json @@ -1,3 +1,4 @@ { + "serverAddress": "localhost", "apiURL": "http://localhost:8080/api" } diff --git a/src/app/configuration.service.ts b/src/app/configuration.service.ts index 006ac23..1fc123b 100644 --- a/src/app/configuration.service.ts +++ b/src/app/configuration.service.ts @@ -9,4 +9,8 @@ export class ConfigurationService { getApiUrl(): string { return config.apiURL } + + getServerAddress(): string { + return config.serverAddress + } } diff --git a/src/app/pages/logout/logout.component.ts b/src/app/pages/logout/logout.component.ts index eaa288c..a29420b 100644 --- a/src/app/pages/logout/logout.component.ts +++ b/src/app/pages/logout/logout.component.ts @@ -3,6 +3,7 @@ import {CookieService} from 'ngx-cookie-service'; import {HeaderComponent} from '../../components/header/header.component'; import {Router} from '@angular/router'; import {MessageService} from 'primeng/api'; +import {ConfigurationService} from '../../configuration.service'; @Component({ selector: 'app-logout', @@ -17,11 +18,11 @@ export class LogoutComponent implements OnInit{ constructor(private cookiesService: CookieService, private messageService: MessageService, - private router: Router) { } + private router: Router, + private configurationService: ConfigurationService,) { } ngOnInit(): void { - // this.cookiesService.deleteAll("/", "localhost"); // deleteAll est bugué - this.cookiesService.delete('author', '/', 'localhost') - this.cookiesService.delete('token', '/', 'localhost') + this.cookiesService.delete('author', '/', this.configurationService.getServerAddress()) + this.cookiesService.delete('token', '/', this.configurationService.getServerAddress()) this.router.navigate(['/']).then(() => this.successMessage('Déconnexion', 'Vous avez été deconnecté avec succès')); }