Typescript conversion.

This commit is contained in:
Mike Cao 2023-11-13 21:36:52 -08:00
parent 366ef35d3d
commit 8775d696b8
29 changed files with 74 additions and 57 deletions

View file

@ -1,28 +0,0 @@
import { useEffect } from 'react';
import useStore, { setConfig } from 'store/app';
import useApi from 'components/hooks/useApi';
let loading = false;
export function useConfig() {
const { config } = useStore();
const { get } = useApi();
const configUrl = process.env.configUrl;
async function loadConfig() {
const data = await get(configUrl);
loading = false;
setConfig(data);
}
useEffect(() => {
if (!config && !loading && configUrl) {
loading = true;
loadConfig();
}
}, []);
return config;
}
export default useConfig;