mirror of
https://github.com/umami-software/umami.git
synced 2026-02-13 00:55:37 +01:00
21 lines
413 B
TypeScript
21 lines
413 B
TypeScript
import { useEffect } from 'react';
|
|
import useStore, { setConfig } from '@/store/app';
|
|
import { getConfig, Config } from '@/app/actions/getConfig';
|
|
|
|
export function useConfig(): Config {
|
|
const { config } = useStore();
|
|
|
|
async function loadConfig() {
|
|
setConfig(await getConfig());
|
|
}
|
|
|
|
useEffect(() => {
|
|
if (!config) {
|
|
loadConfig();
|
|
}
|
|
}, []);
|
|
|
|
return config;
|
|
}
|
|
|
|
export default useConfig;
|