Fix/global search not showing request error (#310)
* Show error message in case search request failed In case of an error the message was showing "no mangas found" * [i18n::en] Sort keys alphabetically
This commit is contained in:
@@ -96,6 +96,7 @@ const SourceSearchPreview = ({
|
||||
size,
|
||||
setSize,
|
||||
isLoading,
|
||||
error,
|
||||
} = requestManager.useSourceSearch(id, searchString ?? '', 1, { skipRequest });
|
||||
const mangas = !isLoading ? searchResult?.[0]?.mangaList ?? [] : [];
|
||||
const noMangasFound = !isLoading && !mangas.length;
|
||||
@@ -108,6 +109,13 @@ const SourceSearchPreview = ({
|
||||
return null;
|
||||
}
|
||||
|
||||
let errorMessage: string | undefined;
|
||||
if (error) {
|
||||
errorMessage = t('search.error.label.source_search_failed');
|
||||
} else if (noMangasFound) {
|
||||
errorMessage = t('manga.error.label.no_mangas_found');
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card sx={{ margin: '10px' }}>
|
||||
@@ -124,7 +132,7 @@ const SourceSearchPreview = ({
|
||||
setLastPageNum={setSize}
|
||||
horizontal
|
||||
noFaces
|
||||
message={noMangasFound ? t('manga.error.label.no_mangas_found') : undefined}
|
||||
message={errorMessage}
|
||||
inLibraryIndicator
|
||||
/>
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user