Skip to content

Commit

Permalink
fix(Web-UI): Display the default image when failing to request a thum…
Browse files Browse the repository at this point in the history
…bnail in the PosterView of media
  • Loading branch information
JasonLandbridge committed May 18, 2023
1 parent ea117d7 commit 5edad67
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ onMounted(() => {
set(isRefreshing, data.isRefreshing);
if (data.isComplete) {
onRequestMedia({ size: 0, page: 0 });
set(isRefreshing, false);
}
}
}),
Expand Down
15 changes: 9 additions & 6 deletions src/WebAPI/ClientAppV2/src/types/api/baseApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ import ResultDTO from '@dto/ResultDTO';
export function checkForError<T = any>(
logText?: string,
fnName?: string,
suppressAlert?: boolean,
): (source$: AxiosObservable<ResultDTO<T>>) => Observable<ResultDTO<T>> {
return (source$) =>
source$.pipe(
catchError((error: AxiosError | any) => {
Log.error('FATAL NETWORK ERROR: ', error);

const url = new URL(error.config.url, error.config.baseURL);
AlertService.showAlert({
id: 0,
title: error.message,
text: `Failed a request to url: ${url}`,
result: JSON.parse(error.config.data),
});
if (!suppressAlert) {
AlertService.showAlert({
id: 0,
title: error.message,
text: `Failed a request to url: ${url}`,
result: JSON.parse(error.config.data),
});
}

// TODO Check wat the error contains in-case, of network failure and continue based on that
return of({
Expand Down
2 changes: 1 addition & 1 deletion src/WebAPI/ClientAppV2/src/types/class/PlexRipperAxios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class PlexRipperAxios {
return Axios.get<ResultDTO<T>>(url, {
params,
responseType,
});
}).pipe(checkForError<T>('Image', 'getImage', true));
}

public static put<T = any>({ url, data, apiCategory, apiName }: PlexRipperAxiosPut) {
Expand Down

0 comments on commit 5edad67

Please sign in to comment.