M: Add prefetching for auth

This commit is contained in:
Ivan 2025-01-29 21:41:28 +03:00
parent 69243dee0b
commit 33e73dfb47
2 changed files with 5 additions and 2 deletions

View File

@ -33,8 +33,6 @@ function ApplicationLayout() {
const noNavigation = useAppLayoutStore(state => state.noNavigation); const noNavigation = useAppLayoutStore(state => state.noNavigation);
const noFooter = useAppLayoutStore(state => state.noFooter); const noFooter = useAppLayoutStore(state => state.noFooter);
// TODO: prefetch data
return ( return (
<ErrorBoundary FallbackComponent={ErrorFallback} onError={logError} onReset={resetState}> <ErrorBoundary FallbackComponent={ErrorFallback} onError={logError} onReset={resetState}>
<NavigationState> <NavigationState>

View File

@ -4,6 +4,11 @@ import { createRoot } from 'react-dom/client';
import App from './app'; import App from './app';
import GlobalProviders from './app/GlobalProviders'; import GlobalProviders from './app/GlobalProviders';
import { authApi } from './backend/auth/api';
import { queryClient } from './backend/queryClient';
// Prefetch auth data
queryClient.prefetchQuery(authApi.getAuthQueryOptions()).catch(console.error);
createRoot(document.getElementById('root')!).render( createRoot(document.getElementById('root')!).render(
<GlobalProviders> <GlobalProviders>