@agribank/ignite
v4.0.2
Published
includes all communication protocols with super app
Downloads
596
Readme
Ignite
This package is responsible for initializing the whole app. Which includes:
- reading config files (using fetch requests to config files)
- reading config params (from search params)
- initializing language and global setting stores
- exporting axios instances (you should use these instances or extend them)
- authenticate
- get theme
all of these happen by calling the useInit
hook which returns the ready
boolean status.
Examples:
import { searchParamsConfigSchema, useInit, useInitialSettingStore } from "@agribank/ignite";
function App() {
const isReady = useInit({
onInitializationFailed: (message) => {
pushAlert({
hasConfirmAction: true,
messageText: message,
type: "error"
});
return false;
}
});
const theme = useInitialSettingStore((state) => state.settings.theme);
return (
{isReady ? <YouApp theme={theme} /> : "loading"}
);
}
- calling
useInitialSettingStore
without theuseInit
is useless (just once in the tree), because it never fills the values.