blob: c1cdcaf671bd2fa46d00f0c690268be3e4ac97a3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
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;
}
|