openreader/src/app/providers.tsx
Richard R eebb54b018 refactor(auth): remove redundant authEnabled flag from contexts and components
Eliminate the unused authEnabled property from context providers, hooks,
components, and API responses. All logic and UI now assume authentication is
required, simplifying prop signatures and reducing branching. Update related
types, context values, and function calls to reflect this change. This streamlines
the authentication flow and removes unnecessary configuration.
2026-05-31 13:10:01 -06:00

45 lines
1.3 KiB
TypeScript

'use client';
import { ReactNode, useState } from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ThemeProvider } from '@/contexts/ThemeContext';
import { AuthRateLimitProvider } from '@/contexts/AuthRateLimitContext';
import { RuntimeConfigProvider } from '@/contexts/RuntimeConfigContext';
import { AuthLoader } from '@/components/auth/AuthLoader';
interface ProvidersProps {
children: ReactNode;
authBaseUrl: string | null;
allowAnonymousAuthSessions: boolean;
githubAuthEnabled: boolean;
}
export function Providers({ children, authBaseUrl, allowAnonymousAuthSessions, githubAuthEnabled }: ProvidersProps) {
const [queryClient] = useState(() => new QueryClient({
defaultOptions: {
queries: {
retry: 1,
refetchOnWindowFocus: false,
},
},
}));
return (
<QueryClientProvider client={queryClient}>
<RuntimeConfigProvider>
<AuthRateLimitProvider
authBaseUrl={authBaseUrl}
allowAnonymousAuthSessions={allowAnonymousAuthSessions}
githubAuthEnabled={githubAuthEnabled}
>
<ThemeProvider>
<AuthLoader>
{children}
</AuthLoader>
</ThemeProvider>
</AuthRateLimitProvider>
</RuntimeConfigProvider>
</QueryClientProvider>
);
}