[auth] fix auth not being cleared after logout

This commit is contained in:
nymkappa 2023-08-21 15:01:31 +02:00
parent 3321ae0f1f
commit b8222bff43
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04
2 changed files with 8 additions and 3 deletions

View File

@ -42,8 +42,13 @@ export class MenuComponent implements OnInit {
} }
logout(): void { logout(): void {
this.apiService.logout$().subscribe(); this.apiService.logout$().subscribe(() => {
this.loggedOut.emit(true); this.loggedOut.emit(true);
if (this.stateService.env.GIT_COMMIT_HASH_MEMPOOL_SPACE) {
this.userMenuGroups$ = this.apiService.getUserMenuGroups$();
this.router.navigateByUrl('/');
}
});
} }
onLinkClick() { onLinkClick() {

View File

@ -368,7 +368,7 @@ export class ApiService {
return of(null); return of(null);
} }
localStorage.setItem('auth', null); localStorage.removeItem('auth');
return this.httpClient.post(`${SERVICES_API_PREFIX}/auth/logout`, { return this.httpClient.post(`${SERVICES_API_PREFIX}/auth/logout`, {
headers: { 'Authorization': auth.token } headers: { 'Authorization': auth.token }
}); });