mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 14:47:14 +01:00
Updated useConfig. Added SSO page.
This commit is contained in:
parent
f10c8ba9e2
commit
c58e037a7e
8 changed files with 69 additions and 32 deletions
|
|
@ -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();
|
||||
}
|
||||
}, []);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue