diff --git a/frontend/src/components/login/login.js b/frontend/src/components/login/login.js index b91a897..3dc4036 100644 --- a/frontend/src/components/login/login.js +++ b/frontend/src/components/login/login.js @@ -12,7 +12,7 @@ import Grid from '@material-ui/core/Grid'; import Link1 from '@material-ui/core/Link'; import { Redirect } from "react-router-dom"; -const url = "/simcompanies/API/user/login" + const useStyles = makeStyles(theme => ({ card: { backgroundColor: "#0B1929", @@ -59,31 +59,32 @@ const CssTextField = withStyles({ }, })(TextField); -const postLogin = async (url, data) => { - const response = await fetch(url, { - method: 'POST', - mode: 'cors', - cache: 'no-cache', - headers: { - 'Content-Type': 'application/json' - }, - redirect: 'follow', - referrerPolicy: 'no-referrer', - body: JSON.stringify(data) - }); - - if (response.status == "200") { - return - } -} - - export default function Login() { const classes = useStyles(); - + const url = "/simcompanies/API/user/login" const [username, setUsername] = React.useState(""); const [password, setPassword] = React.useState(""); + const [login, setLogin] = React.useState(true); + + + const postLogin = async (url, data) => { + const response = await fetch(url, { + method: 'POST', + mode: 'cors', + cache: 'no-cache', + headers: { + 'Content-Type': 'application/json' + }, + redirect: 'follow', + referrerPolicy: 'no-referrer', + body: JSON.stringify(data) + }); + + if (response.status == "200") { + setLogin(false) + } + } const handleClick = (e) => { @@ -100,71 +101,75 @@ export default function Login() { const handleChangePW = (e) => { setPassword(e.target.value) } + + return ( - - - - - SC Dashboard Logo - -
+ + login === true ? + < Box className="loginBackground" display="flex" justifyContent="center" alignItems="center" m={1} p={1} > + + - - - - - Login - - - - - - - - - - - - - - - - - - Create new Account - - - - - - - - - - + SC Dashboard Logo - - -
-
+
+ + + + + + Login + + + + + + + + + + + + + + + + + + Create new Account + + + + + + + + + + + +
+ + + : ) }