From 9378a775a7789c9af9a556205474510d49ae94af Mon Sep 17 00:00:00 2001 From: Tim Spencer <72101647+sei-tspencer@users.noreply.github.com> Date: Tue, 26 Sep 2023 15:48:03 -0400 Subject: [PATCH] fixed exceptions (#58) --- package.json | 2 +- .../components/home-app/home-app.component.ts | 35 ++++++++++--------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 87582c6..1ae63c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gallery-ui", - "version": "1.5.0", + "version": "1.5.1", "scripts": { "ng": "ng", "start": "ng serve", diff --git a/src/app/components/home-app/home-app.component.ts b/src/app/components/home-app/home-app.component.ts index 347dc79..515eb51 100755 --- a/src/app/components/home-app/home-app.component.ts +++ b/src/app/components/home-app/home-app.component.ts @@ -95,7 +95,6 @@ export class HomeAppComponent implements OnDestroy, OnInit { this.collectionDataService.loadMine(); } else { if (exhibitId) { - console.log(exhibitId); if (!this.exhibit || this.exhibit.id !== exhibitId) { this.exhibitDataService.loadById(exhibitId); this.exhibitDataService.setActive(exhibitId); @@ -110,22 +109,24 @@ export class HomeAppComponent implements OnDestroy, OnInit { } this.exhibitDataService.setActive(this.exhibitId); this.collectionDataService.setActive(this.collectionId); - if (this.selectedTeamId && (this.selectedTeamId !== this.teamDataService.getMyTeamId())) { - // observed - if (this.selectedSection === 'archive') { - this.xApiService.observedExhibitArchive(exhibitId, this.selectedTeamId).pipe(take(1)).subscribe(); - } else if (this.selectedSection === 'wall') { - this.xApiService.observedExhibitWall(exhibitId, this.selectedTeamId).pipe(take(1)).subscribe(); - } - } else { - // viewed - if (this.selectedSection === 'archive') { - this.xApiService.viewedExhibitArchive(exhibitId).pipe(take(1)).subscribe(); - if (cardId && cardId !== 'all') { - this.xApiService.viewedCard(exhibitId, cardId).pipe(take(1)).subscribe(); + if (this.exhibitId && this.selectedTeamId) { + if (this.selectedTeamId !== this.teamDataService.getMyTeamId()) { + // observed + if (this.selectedSection === 'archive') { + this.xApiService.observedExhibitArchive(exhibitId, this.selectedTeamId).pipe(take(1)).subscribe(); + } else if (this.selectedSection === 'wall') { + this.xApiService.observedExhibitWall(exhibitId, this.selectedTeamId).pipe(take(1)).subscribe(); + } + } else { + // viewed + if (this.selectedSection === 'archive') { + this.xApiService.viewedExhibitArchive(exhibitId).pipe(take(1)).subscribe(); + if (cardId && cardId !== 'all') { + this.xApiService.viewedCard(exhibitId, cardId).pipe(take(1)).subscribe(); + } + } else if (this.selectedSection === 'wall') { + this.xApiService.viewedExhibitWall(exhibitId).pipe(take(1)).subscribe(); } - } else if (this.selectedSection === 'wall') { - this.xApiService.viewedExhibitWall(exhibitId).pipe(take(1)).subscribe(); } } }); @@ -139,7 +140,7 @@ export class HomeAppComponent implements OnDestroy, OnInit { }); // subscribe to the active exhibit (this.exhibitQuery.selectActive() as Observable).pipe(takeUntil(this.unsubscribe$)).subscribe(exhibit => { - if (!this.exhibit || this.exhibit.id !== exhibit.id) { + if (exhibit && (!this.exhibit || this.exhibit.id !== exhibit.id)) { this.exhibit = exhibit; this.loadExhibitData(); };