mirror of
https://github.com/lemeow125/React-NotesApp.git
synced 2024-11-17 06:29:28 +08:00
Fixed error prompt and not logged in prompt
This commit is contained in:
parent
cfc9a7e1f0
commit
0279e503ff
2 changed files with 17 additions and 15 deletions
|
@ -22,18 +22,18 @@ export default function Notes() {
|
||||||
<p style={styles.text_medium}>Loading Notes...</p>
|
<p style={styles.text_medium}>Loading Notes...</p>
|
||||||
</div>
|
</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) {
|
} else if (error) {
|
||||||
return (
|
return (
|
||||||
<div style={styles.note}>
|
<div style={styles.note}>
|
||||||
<p style={styles.text_medium_red}>Error contacting Notes server</p>
|
<p style={styles.text_medium_red}>Error contacting Notes server</p>
|
||||||
</div>
|
</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) {
|
} else if (notes.length === 0) {
|
||||||
return (
|
return (
|
||||||
<div style={styles.note}>
|
<div style={styles.note}>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { UserInfo } from "../../Components/Api/Api";
|
||||||
import { useQuery } from "react-query";
|
import { useQuery } from "react-query";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import { LoginState } from "../../Interfaces/Interfaces";
|
import { LoginState } from "../../Interfaces/Interfaces";
|
||||||
|
import LoginButton from "../../Components/LoginButton/LoginButton";
|
||||||
|
|
||||||
export default function UserPage() {
|
export default function UserPage() {
|
||||||
const { data, isLoading, error } = useQuery("user", UserInfo, { retry: 0 });
|
const { data, isLoading, error } = useQuery("user", UserInfo, { retry: 0 });
|
||||||
|
@ -17,6 +18,16 @@ export default function UserPage() {
|
||||||
</div>
|
</div>
|
||||||
</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) {
|
} else if (error) {
|
||||||
return (
|
return (
|
||||||
<div style={styles.background}>
|
<div style={styles.background}>
|
||||||
|
@ -26,15 +37,6 @@ export default function UserPage() {
|
||||||
</div>
|
</div>
|
||||||
</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 (
|
return (
|
||||||
<div style={styles.background}>
|
<div style={styles.background}>
|
||||||
|
|
Loading…
Reference in a new issue