Fixed offline error indicator for homepage

This commit is contained in:
keannu125 2023-03-04 22:32:02 +08:00
parent 05c7804421
commit 16176aea9f

View file

@ -16,25 +16,24 @@ export default function Notes() {
error, error,
} = useQuery("notes", GetNotes, { retry: 0 }); } = useQuery("notes", GetNotes, { retry: 0 });
const logged_in = useSelector((state: LoginState) => state.Login.logged_in); const logged_in = useSelector((state: LoginState) => state.Login.logged_in);
if (error) { if (isLoading) {
return (
<div style={styles.note}>
<p style={styles.text_medium_red}>Error contacting Notes server</p>
</div>
);
} else if (isLoading) {
return ( return (
<div style={styles.note}> <div style={styles.note}>
<p style={styles.text_medium}>Loading Notes...</p> <p style={styles.text_medium}>Loading Notes...</p>
</div> </div>
); );
} } else if (!logged_in && !error) {
if (!logged_in) {
return ( return (
<div style={styles.note}> <div style={styles.note}>
<p style={styles.text_medium}>Please login to use Clip Notes</p> <p style={styles.text_medium}>Please login to use Clip Notes</p>
</div> </div>
); );
} else if (error) {
return (
<div style={styles.note}>
<p style={styles.text_medium_red}>Error contacting Notes server</p>
</div>
);
} else if (notes.length === 0) { } else if (notes.length === 0) {
return ( return (
<div style={styles.note}> <div style={styles.note}>