#13 Error alert formatting

This commit is contained in:
2023-03-19 02:22:23 -04:00
parent abb1769c48
commit 851a784aaa
2 changed files with 17 additions and 4 deletions

View File

@@ -1,7 +1,16 @@
import { useEffect } from "react";
import { Container } from "react-bootstrap";
import MyNavbar from "../components/MyNavbar";
const HomePage = () => {
{/*{current_user} = use context*/}
const current_user = null;
useEffect(()=>{
if (!current_user) {
window.location.replace("/login");
}
}, []);
return (
<div>
<MyNavbar />

View File

@@ -9,7 +9,7 @@ const LoginPage = () => {
const [error, setError] = useState(null);
const sendLoginRequest = async (e) => {
e.preventDefault();
e?.preventDefault();
await makeRequest({
url: "http://localhost:5000/login",
method: "POST",
@@ -30,7 +30,11 @@ const LoginPage = () => {
<React.Fragment>
<MyNavbar />
{error && (
<Alert variant="danger" className="m-4 mx-auto w-25">ERROR! {error.message}</Alert>
<Container>
<Alert variant="danger" className="m-4 mx-auto w-50 text-center">
{error.message}
</Alert>
</Container>
)}
<Container className="p-5">
<Form onSubmit={sendLoginRequest}>