From acb46400f73b63e93864b9a23f9607e2460882a2 Mon Sep 17 00:00:00 2001 From: Emily Jablonski Date: Mon, 12 Apr 2021 13:28:40 -0600 Subject: [PATCH] My Applications loading state --- sites/public/pages/account/applications.tsx | 30 ++++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/sites/public/pages/account/applications.tsx b/sites/public/pages/account/applications.tsx index e411ca958c..5b49e227e3 100644 --- a/sites/public/pages/account/applications.tsx +++ b/sites/public/pages/account/applications.tsx @@ -10,6 +10,7 @@ import { RequireLogin, t, UserContext, + LoadingOverlay, } from "@bloom-housing/ui-components" import Layout from "../../layouts/application" import { PaginatedApplication } from "@bloom-housing/backend-core/types" @@ -20,6 +21,7 @@ export default () => { const { profile } = useContext(UserContext) const [applications, setApplications] = useState() const [error, setError] = useState(null) + const [loading, setLoading] = useState(true) useEffect(() => { if (profile) { @@ -27,10 +29,12 @@ export default () => { .list({ userId: profile.id }) .then((apps) => { setApplications(apps) + setLoading(false) }) .catch((err) => { console.error(`Error fetching applications: ${err}`) setError(`${err}`) + setLoading(false) }) } }, [profile, applicationsService]) @@ -49,14 +53,14 @@ export default () => { } return ( - <> - - - - {t("nav.myApplications")} - - -
+ + + + {t("nav.myApplications")} + + +
+
}> @@ -67,13 +71,13 @@ export default () => { ))} - {!applications && noApplicationsSection()} + {!applications && !loading && noApplicationsSection()}
-
-
-
- + +
+
+
) }