mirror of
https://github.com/umami-software/umami.git
synced 2026-02-15 10:05:36 +01:00
Removed SettingsContext. Added hostUrl prop.
This commit is contained in:
parent
fec81695e8
commit
1a70350936
6 changed files with 23 additions and 48 deletions
|
|
@ -1,10 +1,8 @@
|
|||
'use client';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { IntlProvider } from 'react-intl';
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { ReactBasicsProvider } from 'react-basics';
|
||||
import ErrorBoundary from 'components/common/ErrorBoundary';
|
||||
import SettingsContext from 'app/(main)/settings/SettingsContext';
|
||||
import { useLocale } from 'components/hooks';
|
||||
import 'chartjs-adapter-date-fns';
|
||||
|
||||
|
|
@ -26,34 +24,14 @@ function MessagesProvider({ children }) {
|
|||
);
|
||||
}
|
||||
|
||||
function SettingsProvider({ children }) {
|
||||
const [config, setConfig] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
const hostUrl = process.env.hostUrl || window?.location.origin;
|
||||
|
||||
setConfig({
|
||||
shareUrl: hostUrl,
|
||||
trackingCodeUrl: hostUrl,
|
||||
websitesUrl: '/websites',
|
||||
settingsPath: '/settings/websites',
|
||||
websitesPath: `/websites`,
|
||||
});
|
||||
}, []);
|
||||
|
||||
return <SettingsContext.Provider value={config}>{children}</SettingsContext.Provider>;
|
||||
}
|
||||
|
||||
export function Providers({ children }) {
|
||||
return (
|
||||
<MessagesProvider>
|
||||
<SettingsProvider>
|
||||
<QueryClientProvider client={client}>
|
||||
<ReactBasicsProvider>
|
||||
<ErrorBoundary>{children}</ErrorBoundary>
|
||||
</ReactBasicsProvider>
|
||||
</QueryClientProvider>
|
||||
</SettingsProvider>
|
||||
<QueryClientProvider client={client}>
|
||||
<ReactBasicsProvider>
|
||||
<ErrorBoundary>{children}</ErrorBoundary>
|
||||
</ReactBasicsProvider>
|
||||
</QueryClientProvider>
|
||||
</MessagesProvider>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue