Skip to content

Commit

Permalink
fix: login button remains after sys admin login (#975)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelez committed Mar 30, 2023
1 parent b1c2062 commit 5034931
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class LoginFormComponent implements OnInit, AfterViewInit {
const username = this.session.user.name;
this._dspApiConnection.admin.usersEndpoint.getUserByUsername(username).subscribe(
(userResponse: ApiResponseData<UserResponse>) => {
const uuid = this._projectService.iriToUuid(userResponse.body.user.projects[0].id);
const uuid = this._projectService.iriToUuid(userResponse.body.user.projects[0]?.id);
// if user is NOT a sysAdmin and only a member of one project, redirect them to that projects dashboard
if(!this.session.user.sysAdmin && userResponse.body.user.projects.length === 1) {
this._router.navigateByUrl('/refresh', { skipLocationChange: true }).then(
Expand Down
1 change: 0 additions & 1 deletion apps/dsp-app/src/app/user/user-menu/user-menu.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export class UserMenuComponent implements OnChanges {
this.username = this._session.getSession().user.name;
this.sysAdmin = this._session.getSession().user.sysAdmin;

this._cache.get(this.username, this._dspApiConnection.admin.usersEndpoint.getUserByUsername(this.username));
this._cache.get(this.username, this._dspApiConnection.admin.usersEndpoint.getUserByUsername(this.username)).subscribe(
(response: ApiResponseData<UserResponse>) => {
this.user = response.body.user;
Expand Down

0 comments on commit 5034931

Please sign in to comment.