mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 00:27:11 +01:00
Refactored to use app folder.
This commit is contained in:
parent
40cfcd41e9
commit
9a52cdd2e1
258 changed files with 2025 additions and 2258 deletions
39
src/app/Providers.tsx
Normal file
39
src/app/Providers.tsx
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
'use client';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { ReactBasicsProvider } from 'react-basics';
|
||||
import ErrorBoundary from 'components/common/ErrorBoundary';
|
||||
import useLocale from 'components/hooks/useLocale';
|
||||
import 'chartjs-adapter-date-fns';
|
||||
|
||||
const client = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
retry: false,
|
||||
refetchOnWindowFocus: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
function MessagesProvider({ children }) {
|
||||
const { locale, messages } = useLocale();
|
||||
return (
|
||||
<IntlProvider locale={locale} messages={messages[locale]} onError={() => null}>
|
||||
{children}
|
||||
</IntlProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export function Providers({ children }) {
|
||||
return (
|
||||
<MessagesProvider>
|
||||
<QueryClientProvider client={client}>
|
||||
<ReactBasicsProvider>
|
||||
<ErrorBoundary>{children}</ErrorBoundary>
|
||||
</ReactBasicsProvider>
|
||||
</QueryClientProvider>
|
||||
</MessagesProvider>
|
||||
);
|
||||
}
|
||||
|
||||
export default Providers;
|
||||
Loading…
Add table
Add a link
Reference in a new issue