From 3377c87449f38d7e28462d69c34f81975e0d2b25 Mon Sep 17 00:00:00 2001 From: cristhianzl Date: Wed, 28 Feb 2024 10:19:58 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(authContext.tsx):=20add=20im?= =?UTF-8?q?port=20statement=20for=20useFlowsManagerStore=20to=20fix=20miss?= =?UTF-8?q?ing=20import=20error=20=F0=9F=94=A7=20fix(authContext.tsx):=20s?= =?UTF-8?q?et=20isLoading=20to=20false=20in=20useFlowsManagerStore=20after?= =?UTF-8?q?=20setLoading=20to=20false=20to=20fix=20loading=20state=20incon?= =?UTF-8?q?sistency=20=F0=9F=94=A7=20fix(typesStore.ts):=20add=20null=20ch?= =?UTF-8?q?eck=20for=20response.data=20to=20fix=20potential=20null=20refer?= =?UTF-8?q?ence=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/contexts/authContext.tsx | 2 ++ src/frontend/src/stores/typesStore.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/contexts/authContext.tsx b/src/frontend/src/contexts/authContext.tsx index 256712303..f0c8ec1d6 100644 --- a/src/frontend/src/contexts/authContext.tsx +++ b/src/frontend/src/contexts/authContext.tsx @@ -7,6 +7,7 @@ import { requestLogout, } from "../controllers/API"; import useAlertStore from "../stores/alertStore"; +import useFlowsManagerStore from "../stores/flowsManagerStore"; import { Users } from "../types/api"; import { AuthContextType } from "../types/contexts/auth"; @@ -79,6 +80,7 @@ export function AuthProvider({ children }): React.ReactElement { getUser(); } else { setLoading(false); + useFlowsManagerStore.setState({ isLoading: false }); } }); }, [setUserData, setLoading, autoLogin, setIsAdmin]); diff --git a/src/frontend/src/stores/typesStore.ts b/src/frontend/src/stores/typesStore.ts index 1a0ae3634..557a3a30d 100644 --- a/src/frontend/src/stores/typesStore.ts +++ b/src/frontend/src/stores/typesStore.ts @@ -16,7 +16,7 @@ export const useTypesStore = create((set, get) => ({ setLoading(true); getAll() .then((response) => { - const data = response.data; + const data = response?.data; useAlertStore.setState({ loading: false }); set((old) => ({ types: typesGenerator(data),