Handle error during manga refresh

The error of the refresh mutation was never catched and shown
This commit is contained in:
schroda
2024-05-11 01:10:55 +02:00
parent eb72c78acc
commit 6b690cfd8d
2 changed files with 10 additions and 4 deletions

View File

@@ -32,13 +32,15 @@ export const Manga: React.FC = () => {
const { id } = useParams<{ id: string }>();
const autofetchedRef = useRef(false);
const { data, error, loading: isLoading, networkStatus, refetch } = requestManager.useGetManga(id);
const { data, error: mangaError, loading: isLoading, networkStatus, refetch } = requestManager.useGetManga(id);
const isValidating = isNetworkRequestInFlight(networkStatus);
const manga = data?.manga;
const [refresh, { loading: refreshing }] = useRefreshManga(id);
const [refresh, { loading: refreshing, error: refreshError }] = useRefreshManga(id);
useSetDefaultBackTo('library');
const error = mangaError ?? refreshError;
useEffect(() => {
if (manga == null) return;