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:
schroda
2023-05-18 13:25:19 +02:00
committed by GitHub
parent f86c7ea08a
commit a457d80c44
34 changed files with 950 additions and 333 deletions

View File

@@ -13,9 +13,8 @@ import ListItemText from '@mui/material/ListItemText';
import ListItemLink from 'components/util/ListItemLink';
import NavbarContext from 'components/context/NavbarContext';
import LoadingPlaceholder from 'components/util/LoadingPlaceholder';
import { useQuery } from 'util/client';
import { IAbout } from 'typings';
import { useTranslation } from 'react-i18next';
import requestManager from 'lib/RequestManager';
export default function About() {
const { t } = useTranslation();
@@ -26,7 +25,7 @@ export default function About() {
setAction(null);
}, [t]);
const { data: about } = useQuery<IAbout>('/api/v1/settings/about');
const { data: about } = requestManager.useGetAbout();
if (about === undefined) {
return <LoadingPlaceholder />;