Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import {of, ReplaySubject} from 'rxjs';
import {of, ReplaySubject, Observable} from 'rxjs';
import {catchError, shareReplay, switchMap, map, tap} from 'rxjs/operators';
import {HandledRoute} from 'dist/scully';

export interface ScullyRoute {
route: string;
Expand All @@ -18,9 +19,7 @@ export class ScullyRoutesService {
available$ = this.refresh.pipe(
switchMap(() => this.http.get<ScullyRoute[]>('/assets/scully-routes.json')),
catchError(() => {
console.warn(
'Scully routes file not found, are you running the in static version of your site?'
);
console.warn('Scully routes file not found, are you running the in static version of your site?');
return of([] as ScullyRoute[]);
}),
shareReplay({refCount: false, bufferSize: 1})
Expand All @@ -36,10 +35,10 @@ export class ScullyRoutesService {
this.reload();
}

getCurrent() {
getCurrent(): Observable<ScullyRoute> {
if (!location) {
/** probably not in a browser, no current location available */
return of([]);
return of();
}
const curLocation = location.pathname;
return this.available$.pipe(
Expand Down