Skip to content

Commit

Permalink
fix the trackRouteParam utility method
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreybakker committed Aug 19, 2024
1 parent 7bdcf90 commit 9f3ef65
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/services/api/event.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { HttpClient } from "@angular/common/http";
import { combineLatest, expand, map, Observable, switchMap } from "rxjs";
import { Album, PhotoEvent, EventCreate, EventDetailed, EventUpdate, S3PreSignedUrl } from "../../util/types";
import { combineLatest, map, Observable, switchMap } from "rxjs";
import { Album, EventCreate, EventDetailed, EventUpdate, PhotoEvent, S3PreSignedUrl } from "../../util/types";
import { BaseService, FetchedObject } from "../base.service";
import { ActivatedRoute, Router } from "@angular/router";
import { S3Service } from "../s3.service";
Expand All @@ -22,10 +22,8 @@ export class EventService extends BaseService {
constructor(
router: Router,
activatedRoute: ActivatedRoute,

protected http: HttpClient,
protected s3: S3Service,

protected albumService: AlbumService,
) {
super(router, activatedRoute);
Expand Down
9 changes: 6 additions & 3 deletions src/services/base.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, Router } from "@angular/router";
import {
catchError,
combineLatest, distinctUntilChanged,
combineLatest,
distinctUntilChanged,
filter,
first,
map,
Expand All @@ -12,8 +13,7 @@ import {
shareReplay,
startWith,
Subject,
switchMap,
tap
switchMap
} from "rxjs";

export abstract class BaseService {
Expand Down Expand Up @@ -42,6 +42,9 @@ export abstract class BaseService {
// Cache the latest route snapshot
shareReplay(1),
);

// Prime the observable
this.route$.pipe(first()).subscribe();
}

protected trackRouteParam(name: string): Observable<string | null> {
Expand Down

0 comments on commit 9f3ef65

Please sign in to comment.