Fixed error prompt and not logged in prompt

This commit is contained in:
keannu125 2023-03-05 14:09:10 +08:00
parent cfc9a7e1f0
commit 0279e503ff
2 changed files with 17 additions and 15 deletions

View file

@ -22,18 +22,18 @@ export default function Notes() {
<p style={styles.text_medium}>Loading Notes...</p>
</div>
);
} else if (!logged_in && error) {
return (
<div style={styles.note}>
<p style={styles.text_medium}>Please login to use Clip Notes</p>
</div>
);
} else if (error) {
return (
<div style={styles.note}>
<p style={styles.text_medium_red}>Error contacting Notes server</p>
</div>
);
} else if (!logged_in) {
return (
<div style={styles.note}>
<p style={styles.text_medium}>Please login to use Clip Notes</p>
</div>
);
} else if (notes.length === 0) {
return (
<div style={styles.note}>

View file

@ -4,6 +4,7 @@ import { UserInfo } from "../../Components/Api/Api";
import { useQuery } from "react-query";
import { useSelector } from "react-redux";
import { LoginState } from "../../Interfaces/Interfaces";
import LoginButton from "../../Components/LoginButton/LoginButton";
export default function UserPage() {
const { data, isLoading, error } = useQuery("user", UserInfo, { retry: 0 });
@ -17,6 +18,16 @@ export default function UserPage() {
</div>
</div>
);
} else if (!logged_in && error) {
return (
<div style={styles.background}>
<Header />
<div style={styles.note}>
<p style={styles.text_medium}>Please login to view user info</p>
<LoginButton />
</div>
</div>
);
} else if (error) {
return (
<div style={styles.background}>
@ -26,15 +37,6 @@ export default function UserPage() {
</div>
</div>
);
} else if (!logged_in) {
return (
<div style={styles.background}>
<Header />
<div style={styles.note}>
<p style={styles.text_medium_red}>Please login to view user info</p>
</div>
</div>
);
}
return (
<div style={styles.background}>