Skip to content

Commit

Permalink
initial set up of form
Browse files Browse the repository at this point in the history
  • Loading branch information
ebisLab committed Feb 28, 2020
1 parent 374b06b commit 22b28ef
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
28 changes: 27 additions & 1 deletion client/src/components/Login.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
import React from "react";
import React, { useState } from "react";

const Login = () => {
const [login, setLogin] = useState({
username: '',
password: ''
})
// make a post request to retrieve a token from the api
// when you have handled the token, navigate to the BubblePage route

const changeHandler =(e)=>{
setLogin({...login, [e.target.name]: e.target.value})
console.log(login, '<--login')
console.log(e.target.value)
}

return (
<>
<h1>Welcome to the Bubble App!</h1>
<p>Build a login page here</p>
<form>
<input
placeholder="username"
label="username"
name="username"
value={login.username}
onChange={changeHandler} />
<input
placeholder="password"
label="password"
name="password"
value={login.password}
onChange={changeHandler}/>
<button>Login</button>
</form>
</>
);
};
Expand Down
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function authenticator(req, res, next) {

app.post("/api/login", (req, res) => {
const { username, password } = req.body;
if (username === "Lambda School" && password === "i<3Lambd4") {
if (username === "test" && password === "test") {
req.loggedIn = true;
setTimeout(() => {
res.status(200).json({
Expand Down

0 comments on commit 22b28ef

Please sign in to comment.