Updated useConfig. Added SSO page.

This commit is contained in:
Mike Cao committed 2022-10-31 11:02:37 -07:00
1 parent f10c8ba9e2
commit c58e037a7e
8 files changed
+69 -32

No files matched your search

+4 -3
View File
@@ -2,7 +2,7 @@ import { useEffect } from 'react';
import useStore, { setConfig } from 'store/app';
import useApi from 'hooks/useApi';
let fetched = false;
let loading = false;
export default function useConfig() {
const { config } = useStore();
@@ -10,12 +10,13 @@ export default function useConfig() {
async function loadConfig() {
const { data } = await get('/config');
loading = false;
setConfig(data);
}
useEffect(() => {
if (!config && !fetched) {
fetched = true;
if (!config && !loading) {
loading = true;
loadConfig();
}
}, []);