🔧 fix(authContext.tsx): add import statement for useFlowsManagerStore to fix missing import error
🔧 fix(authContext.tsx): set isLoading to false in useFlowsManagerStore after setLoading to false to fix loading state inconsistency 🔧 fix(typesStore.ts): add null check for response.data to fix potential null reference error
This commit is contained in:
parent
6b2d0c6ef1
commit
3377c87449
2 changed files with 3 additions and 1 deletions
|
|
@ -7,6 +7,7 @@ import {
|
||||||
requestLogout,
|
requestLogout,
|
||||||
} from "../controllers/API";
|
} from "../controllers/API";
|
||||||
import useAlertStore from "../stores/alertStore";
|
import useAlertStore from "../stores/alertStore";
|
||||||
|
import useFlowsManagerStore from "../stores/flowsManagerStore";
|
||||||
import { Users } from "../types/api";
|
import { Users } from "../types/api";
|
||||||
import { AuthContextType } from "../types/contexts/auth";
|
import { AuthContextType } from "../types/contexts/auth";
|
||||||
|
|
||||||
|
|
@ -79,6 +80,7 @@ export function AuthProvider({ children }): React.ReactElement {
|
||||||
getUser();
|
getUser();
|
||||||
} else {
|
} else {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
useFlowsManagerStore.setState({ isLoading: false });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, [setUserData, setLoading, autoLogin, setIsAdmin]);
|
}, [setUserData, setLoading, autoLogin, setIsAdmin]);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export const useTypesStore = create<TypesStoreType>((set, get) => ({
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
getAll()
|
getAll()
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const data = response.data;
|
const data = response?.data;
|
||||||
useAlertStore.setState({ loading: false });
|
useAlertStore.setState({ loading: false });
|
||||||
set((old) => ({
|
set((old) => ({
|
||||||
types: typesGenerator(data),
|
types: typesGenerator(data),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue