api refactoring

This commit is contained in:
proddy
2024-08-09 14:35:33 +02:00
parent 93ed502e57
commit 251b0ea287
24 changed files with 134 additions and 150 deletions

View File

@@ -2,8 +2,7 @@ import { useContext } from 'react';
import type { FC } from 'react';
import { Navigate } from 'react-router-dom';
import * as AuthenticationApi from 'api/authentication';
import { fetchLoginRedirect } from 'components/routing/authentication';
import { AuthenticationContext } from 'contexts/authentication';
import type { RequiredChildrenProps } from 'utils';
@@ -11,7 +10,7 @@ const RequireUnauthenticated: FC<RequiredChildrenProps> = ({ children }) => {
const authenticationContext = useContext(AuthenticationContext);
return authenticationContext.me ? (
<Navigate to={AuthenticationApi.fetchLoginRedirect()} />
<Navigate to={fetchLoginRedirect()} />
) : (
<>{children}</>
);