aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/src
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-08-08 16:19:43 +0800
committercrupest <crupest@outlook.com>2020-08-08 16:19:43 +0800
commit8b8290701b665dbe6ad1742a5691e4838bbbb997 (patch)
treea4051ad33697f01bffeb73c0ef63e57433975632 /Timeline/ClientApp/src
parent18065fa9d203a9187df46bf4ed6328ffdc10bdc5 (diff)
downloadtimeline-8b8290701b665dbe6ad1742a5691e4838bbbb997.tar.gz
timeline-8b8290701b665dbe6ad1742a5691e4838bbbb997.tar.bz2
timeline-8b8290701b665dbe6ad1742a5691e4838bbbb997.zip
Wait for localforage ready.
Diffstat (limited to 'Timeline/ClientApp/src')
-rw-r--r--Timeline/ClientApp/src/app/App.tsx6
1 files changed, 5 insertions, 1 deletions
diff --git a/Timeline/ClientApp/src/app/App.tsx b/Timeline/ClientApp/src/app/App.tsx
index 03775275..31ff9a4e 100644
--- a/Timeline/ClientApp/src/app/App.tsx
+++ b/Timeline/ClientApp/src/app/App.tsx
@@ -12,6 +12,7 @@ import User from './user/User';
import TimelinePage from './timeline/TimelinePage';
import AlertHost from './common/AlertHost';
+import { dataStorage } from './data/common';
import { userService, useRawUser } from './data/user';
const NoMatch: React.FC = () => {
@@ -29,14 +30,17 @@ const LazyAdmin = React.lazy(() =>
);
const App: React.FC = () => {
+ const [loading, setLoading] = React.useState<boolean>(true);
+
const user = useRawUser();
React.useEffect(() => {
void userService.checkLoginState();
+ void dataStorage.ready().then(() => setLoading(false));
}, []);
let body;
- if (user === undefined) {
+ if (user === undefined || loading) {
body = <LoadingPage />;
} else {
body = (