Feature/streamline backend requests (#297)
* Introduce "RequestManager"
* Use "RequestManager" - Simple replacements
- Get rid of all "util/client" imports
- replace old requests with new "RequestManager"
- remove "fetcher" from global SWR config
instead of using the SWR hooks by themselves, the "requestManager" is supposed to be used
* Use "RequestManager" - Do requests via SWR hooks
Use SWR hooks at places where it's easily usable
* Prevent trailing slashes in the "baseUrl"
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
|
||||
import React, { useRef } from 'react';
|
||||
import SpinnerImage from 'components/util/SpinnerImage';
|
||||
import useLocalStorage from 'util/useLocalStorage';
|
||||
import Box from '@mui/system/Box';
|
||||
import { IReaderSettings } from 'typings';
|
||||
|
||||
@@ -68,8 +67,6 @@ interface IProps {
|
||||
const Page = React.forwardRef((props: IProps, ref: any) => {
|
||||
const { src, index, onImageLoad, settings } = props;
|
||||
|
||||
const [useCache] = useLocalStorage<boolean>('useCache', true);
|
||||
|
||||
const imgRef = useRef<HTMLImageElement>(null);
|
||||
|
||||
const imgStyle = imageStyle(settings);
|
||||
@@ -77,7 +74,7 @@ const Page = React.forwardRef((props: IProps, ref: any) => {
|
||||
return (
|
||||
<Box ref={ref} sx={{ margin: 'auto' }}>
|
||||
<SpinnerImage
|
||||
src={`${src}?useCache=${useCache}`}
|
||||
src={src}
|
||||
onImageLoad={onImageLoad}
|
||||
alt={`Page #${index}`}
|
||||
imgRef={imgRef}
|
||||
|
||||
Reference in New Issue
Block a user