mirror of
https://github.com/lemeow125/Ivy-Frontend.git
synced 2024-11-17 06:39:25 +08:00
Added error and loading pages to dashboard
This commit is contained in:
parent
f837903392
commit
d518abec77
2 changed files with 30 additions and 2 deletions
|
@ -11,7 +11,8 @@ export default function LoginChecker() {
|
|||
const old_session_checked = useSelector(
|
||||
(state: OldSessionState) => state.old_session_checked.value
|
||||
);
|
||||
if (!logged_in && old_session_checked) {
|
||||
if (!logged_in && !old_session_checked) {
|
||||
} else if (!logged_in && old_session_checked) {
|
||||
console.log("Not logged in. Redirecting to login page");
|
||||
return <Navigate to="/Login" replace />;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,34 @@ export default function Dashboard() {
|
|||
const logs = useQuery("logs", GetLogs, { retry: 0 });
|
||||
const products = useQuery("products", GetProducts, { retry: 0 });
|
||||
if (logs.isLoading && products.isLoading) {
|
||||
return <div>heh</div>;
|
||||
return (
|
||||
<div>
|
||||
<LoginChecker />
|
||||
<div style={styles.flex_row}>
|
||||
<HomeIcon size={64} color="white" />
|
||||
<p style={{ ...styles.text_white, ...styles.text_XL }}>Dashboard</p>
|
||||
</div>
|
||||
<div style={{ ...styles.content_column, ...{ alignItems: "center" } }}>
|
||||
<p style={{ ...styles.text_white, ...styles.text_L }}>
|
||||
Loading dashboard...
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
if (logs.error || products.error) {
|
||||
<div>
|
||||
<LoginChecker />
|
||||
<div style={styles.flex_row}>
|
||||
<HomeIcon size={64} color="white" />
|
||||
<p style={{ ...styles.text_white, ...styles.text_XL }}>Dashboard</p>
|
||||
</div>
|
||||
<div style={{ ...styles.content_column, ...{ alignItems: "center" } }}>
|
||||
<p style={{ ...styles.text_red, ...styles.text_L }}>
|
||||
Error loading dashboard
|
||||
</p>
|
||||
</div>
|
||||
</div>;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
|
|
Loading…
Reference in a new issue