Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout #1050

Merged
merged 4 commits into from
Nov 2, 2023
Merged

Logout #1050

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/app/account/service/account.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core'
import { SessionStorageService } from 'ngx-webstorage'
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'
import { BehaviorSubject, EMPTY, Observable, Subject, catchError, map, of, takeUntil, tap } from 'rxjs'

Check warning on line 4 in ui/src/app/account/service/account.service.ts

View workflow job for this annotation

GitHub Actions / format

'of' is defined but never used

Check warning on line 4 in ui/src/app/account/service/account.service.ts

View workflow job for this annotation

GitHub Actions / format

'tap' is defined but never used

import { SERVER_API_URL } from '../../../app/app.constants'
import { IAccount } from '../model/account.model'
Expand All @@ -14,7 +14,7 @@
private isFetchingAccountData = false
private stopFetchingAccountData = new Subject()
private authenticated = false
private authenticationState = new BehaviorSubject<any>(null)

Check warning on line 17 in ui/src/app/account/service/account.service.ts

View workflow job for this annotation

GitHub Actions / format

Unexpected any. Specify a different type
private logoutAsResourceUrl = SERVER_API_URL + 'services/userservice/api'

constructor(
Expand Down Expand Up @@ -175,7 +175,7 @@
}

isLoggedAs(): boolean {
return !!(this.isIdentityResolved() && this.accountData.value!.loggedAs)
return !!(this.isIdentityResolved() && this.accountData.value && this.accountData.value.loggedAs)
}

logoutAs(): Observable<any> {
Expand Down
4 changes: 1 addition & 3 deletions ui/src/app/account/service/auth-jwt.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Injectable } from '@angular/core'
import { HttpClient, HttpResponse } from '@angular/common/http'
import { Observable } from 'rxjs'

import { SERVER_API_URL } from '../../../app/app.constants'
import { ILoginCredentials, ILoginResult } from '../model/login.model'

@Injectable({ providedIn: 'root' })
Expand Down Expand Up @@ -31,6 +29,6 @@ export class AuthServerProvider {
*/

logout(): Observable<any> {
return this.http.post(SERVER_API_URL + '/auth/logout', null)
return this.http.post('/auth/logout', null)
}
}
2 changes: 1 addition & 1 deletion ui/src/app/layout/navbar/navbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@
</li>
<li>
<a
*appappHasAnyAuthority="'ROLE_ADMIN'"
*appHasAnyAuthority="'ROLE_ADMIN'"
class="dropdown-item"
routerLink="member"
routerLinkActive="active"
Expand Down
3 changes: 2 additions & 1 deletion ui/src/app/layout/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ export class NavbarComponent implements OnInit {
} else {
this.memberService.setManagedMember(null)
this.loginService.logout()
this.router.navigate([''])
console.log('logged out now')
this.router.navigate(['/login'])
}
}

Expand Down
Loading