33 lines
859 B
TypeScript
33 lines
859 B
TypeScript
'use client';
|
|
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
import { Provider as ReduxProvider } from 'react-redux';
|
|
import { useState } from 'react';
|
|
import { createStore } from '@/stores/redux/store';
|
|
import '@/i18n/config';
|
|
import { syncLocaleOnLoad } from '@/stores/zustand/locale-store';
|
|
|
|
// Sync persisted locale with i18next on app load
|
|
syncLocaleOnLoad();
|
|
|
|
export function Providers({ children }: { children: React.ReactNode }) {
|
|
const [queryClient] = useState(() => new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
staleTime: 5 * 60 * 1000,
|
|
retry: 1,
|
|
},
|
|
},
|
|
}));
|
|
|
|
const [store] = useState(() => createStore());
|
|
|
|
return (
|
|
<ReduxProvider store={store}>
|
|
<QueryClientProvider client={queryClient}>
|
|
{children}
|
|
</QueryClientProvider>
|
|
</ReduxProvider>
|
|
);
|
|
}
|