Skip to content

Commit

Permalink
fixed exceptions (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-tspencer authored Sep 26, 2023
1 parent b6bab97 commit 9378a77
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gallery-ui",
"version": "1.5.0",
"version": "1.5.1",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
35 changes: 18 additions & 17 deletions src/app/components/home-app/home-app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
}
});
Expand All @@ -139,7 +140,7 @@ export class HomeAppComponent implements OnDestroy, OnInit {
});
// subscribe to the active exhibit
(this.exhibitQuery.selectActive() as Observable<Exhibit>).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();
};
Expand Down

0 comments on commit 9378a77

Please sign in to comment.