Skip to content

Commit

Permalink
display correctly org on first load #1127
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Dec 16, 2022
1 parent 3e47c6f commit eadaa8c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions frontend-admin/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { ActivationEnd, Router } from '@angular/router';
import { ActivatedRoute, ActivationEnd, Router } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { filter, map, Observable, of, tap, zip } from 'rxjs';
import { combineLatest, filter, map, Observable, of } from 'rxjs';
import { Organization } from './model/organization';
import { UserInfo } from './model/user';
import { OrgSelectorComponent } from './org-selector/org-selector.component';
Expand Down Expand Up @@ -36,10 +36,10 @@ export class AppComponent implements OnInit {
this.organizations$ = this.organizationService.getOrganizations();
this.organizationId$ = this.router.events.pipe(filter(a => a instanceof ActivationEnd), map(a => {
const ae = a as ActivationEnd;
return ae.snapshot.paramMap.get('organizationId');
return ae.snapshot.params['organizationId'];
}));
this.currentUser$ = this.userService.getCurrent();
this.currentOrganization$ = zip(this.organizationId$, this.organizations$)
this.currentOrganization$ = combineLatest([this.organizationId$, this.organizations$])
.pipe(map(([id, orgs]) => orgs.find(o => id !== null && o.id === Number.parseInt(id))));
}

Expand Down

0 comments on commit eadaa8c

Please sign in to comment.