Files
Sankofa/portal/src/app/providers.tsx
defiQUG 85fe29adc1 portal: Apollo dashboard queries, strict TypeScript build, UI primitives
- Add GraphQL dashboard operations, ApolloProvider, CardDescription, label/checkbox/alert
- Fix case-sensitive UI imports, Crossplane VM metadata uid, VMList spec parsing
- Extend next-auth session user (id, role); fairness filters as unknown; ESLint relax to warnings
- Remove unused session destructure across pages; next.config without skip TS/ESLint

api: GraphQL/WebSocket hardening, logger import in websocket service
Made-with: Cursor
2026-03-25 20:46:57 -07:00

43 lines
1.2 KiB
TypeScript

'use client';
import { ApolloClient, ApolloProvider, HttpLink, InMemoryCache } from '@apollo/client';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { SessionProvider } from 'next-auth/react';
import { useState } from 'react';
function createApolloClient() {
const uri =
process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT || 'http://localhost:4000/graphql';
return new ApolloClient({
cache: new InMemoryCache(),
link: new HttpLink({ uri, credentials: 'include' }),
defaultOptions: {
watchQuery: { fetchPolicy: 'cache-and-network' },
},
});
}
export function Providers({ children }: { children: React.ReactNode }) {
const [queryClient] = useState(
() =>
new QueryClient({
defaultOptions: {
queries: {
staleTime: 60 * 1000, // 1 minute
refetchOnWindowFocus: false,
},
},
})
);
const [apolloClient] = useState(createApolloClient);
return (
<SessionProvider>
<ApolloProvider client={apolloClient}>
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
</ApolloProvider>
</SessionProvider>
);
}