mirror of
https://github.com/umami-software/umami.git
synced 2026-02-05 05:07:15 +01:00
33 lines
655 B
TypeScript
33 lines
655 B
TypeScript
import { useEffect } from 'react';
|
|
import { useApi } from '@/components/hooks/useApi';
|
|
import { setConfig, useApp } from '@/store/app';
|
|
|
|
export type Config = {
|
|
cloudMode: boolean;
|
|
faviconUrl?: string;
|
|
linksUrl?: string;
|
|
pixelsUrl?: string;
|
|
privateMode: boolean;
|
|
telemetryDisabled: boolean;
|
|
trackerScriptName?: string;
|
|
updatesDisabled: boolean;
|
|
};
|
|
|
|
export function useConfig(): Config {
|
|
const { config } = useApp();
|
|
const { get } = useApi();
|
|
|
|
async function loadConfig() {
|
|
const data = await get(`/config`);
|
|
|
|
setConfig(data);
|
|
}
|
|
|
|
useEffect(() => {
|
|
if (!config) {
|
|
loadConfig();
|
|
}
|
|
}, []);
|
|
|
|
return config;
|
|
}
|