Updated useConfig. Added SSO page.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}, []);
|
||||
|
||||
Reference in New Issue
Block a user