From 396acf3bbbe00a192cb0ea0a9ccf91b1d8d2850b Mon Sep 17 00:00:00 2001 From: Fuwn <50817549+Fuwn@users.noreply.github.com> Date: Sat, 24 Jan 2026 13:09:50 +0000 Subject: Initial commit Created from https://vercel.com/new --- src/components/hooks/useConfig.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/components/hooks/useConfig.ts (limited to 'src/components/hooks/useConfig.ts') diff --git a/src/components/hooks/useConfig.ts b/src/components/hooks/useConfig.ts new file mode 100644 index 0000000..c1cdcaf --- /dev/null +++ b/src/components/hooks/useConfig.ts @@ -0,0 +1,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; +} -- cgit v1.2.3