Files
umami/src/components/hooks/useConfig.ts
2025-03-22 03:48:18 -07:00

20 lines
366 B
TypeScript

import { useEffect } from 'react';
import { useApp, setConfig } from '@/store/app';
import { getConfig } from '@/app/actions/getConfig';
export function useConfig() {
const { config } = useApp();
async function loadConfig() {
setConfig(await getConfig());
}
useEffect(() => {
if (!config) {
loadConfig();
}
}, []);
return config;
}