Improve app loading state

This commit is contained in:
Prayag Prajapati committed 2023-08-28 16:13:04 +05:30
1 parent 7df0f3f9d3
commit f65e32cd49
8 files changed
+140 -33

No files matched your search

+16
View File
@@ -71,6 +71,7 @@ import { delUser, getUser } from "./utils/storage/user.js";
import axios from "axios";
import { useBackdropStore } from "./utils/store/backdrop.js";
import { useAppLoadingStore } from "./utils/store/appLoading.js";
const jellyfin = new Jellyfin({
clientInfo: {
@@ -131,6 +132,21 @@ function App() {
const [serverReachable, setServerReachable] = useState(true);
const [setIsAppLoading, setIsAppSuccess, setIsAppError] =
useAppLoadingStore((state) => [
state.setIsLoading,
state.setIsSuccess,
state.setIsError,
]);
useEffect(() => {
const appLoadingStateTimer = setInterval(() => {
setIsAppSuccess(false);
setIsAppError(false);
}, 8000);
return () => clearInterval(appLoadingStateTimer);
}, [setIsAppSuccess, setIsAppError]);
const { enqueueSnackbar } = useSnackbar();
const createApi = async () => {