2021-08-27 12:11:24 +00:00
|
|
|
import { Provider } from "next-auth/client";
|
2021-09-22 19:52:38 +00:00
|
|
|
import React from "react";
|
2021-09-24 10:16:46 +00:00
|
|
|
import { HydrateProps, QueryClient, QueryClientProvider } from "react-query";
|
2021-08-27 12:11:24 +00:00
|
|
|
import { Hydrate } from "react-query/hydration";
|
|
|
|
|
2021-09-24 10:16:46 +00:00
|
|
|
import { Session } from "@lib/auth";
|
2021-09-22 19:52:38 +00:00
|
|
|
import { createTelemetryClient, TelemetryProvider } from "@lib/telemetry";
|
|
|
|
|
2021-08-27 12:11:24 +00:00
|
|
|
export const queryClient = new QueryClient();
|
|
|
|
|
2021-09-24 10:16:46 +00:00
|
|
|
type AppProviderProps = {
|
|
|
|
pageProps: {
|
|
|
|
session?: Session;
|
|
|
|
dehydratedState?: HydrateProps;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const AppProviders: React.FC<AppProviderProps> = ({ pageProps, children }) => {
|
2021-08-27 12:11:24 +00:00
|
|
|
return (
|
|
|
|
<TelemetryProvider value={createTelemetryClient()}>
|
|
|
|
<QueryClientProvider client={queryClient}>
|
|
|
|
<Hydrate state={pageProps.dehydratedState}>
|
2021-09-24 10:16:46 +00:00
|
|
|
<Provider session={pageProps.session}>{children}</Provider>
|
2021-08-27 12:11:24 +00:00
|
|
|
</Hydrate>
|
|
|
|
</QueryClientProvider>
|
|
|
|
</TelemetryProvider>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default AppProviders;
|