feat(frontend): add react spa with wishlist flows and public profile
This commit is contained in:
34
apps/frontend/src/App.tsx
Normal file
34
apps/frontend/src/App.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { useEffect } from 'react';
|
||||
import { RouterProvider } from 'react-router-dom';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { Toaster } from 'sonner';
|
||||
import { router } from './routes';
|
||||
import { useAuthStore } from './features/auth/authStore';
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
retry: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
function AuthBoot({ children }: { children: React.ReactNode }) {
|
||||
const init = useAuthStore((s) => s.init);
|
||||
useEffect(() => {
|
||||
void init();
|
||||
}, [init]);
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
export function App() {
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<AuthBoot>
|
||||
<RouterProvider router={router} />
|
||||
</AuthBoot>
|
||||
<Toaster position="top-center" richColors closeButton />
|
||||
</QueryClientProvider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user