Updated useConfig. Added SSO page.

This commit is contained in:
Mike Cao 2022-10-31 11:02:37 -07:00
parent f10c8ba9e2
commit c58e037a7e
8 changed files with 69 additions and 32 deletions

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();
}
}, []);