mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-22 22:03:35 -04:00
Fixed handling of 4xx status codes when using instant loading
This commit is contained in:
@@ -24,11 +24,12 @@ import {
|
||||
EMPTY,
|
||||
Observable,
|
||||
catchError,
|
||||
filter,
|
||||
from,
|
||||
map,
|
||||
of,
|
||||
shareReplay,
|
||||
switchMap
|
||||
switchMap,
|
||||
throwError
|
||||
} from "rxjs"
|
||||
|
||||
/* ----------------------------------------------------------------------------
|
||||
@@ -51,8 +52,11 @@ export function request(
|
||||
): Observable<Response> {
|
||||
return from(fetch(`${url}`, options))
|
||||
.pipe(
|
||||
filter(res => res.status === 200),
|
||||
catchError(() => EMPTY)
|
||||
catchError(() => EMPTY),
|
||||
switchMap(res => res.status !== 200
|
||||
? throwError(() => new Error(res.statusText))
|
||||
: of(res)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user