-
Notifications
You must be signed in to change notification settings - Fork 0
/
new_index.html
85 lines (78 loc) · 2.18 KB
/
new_index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<!DOCTYPE html>
<html>
<head>
<title>
Cocktail Maker
</title>
<!-- <link rel="stylesheet" type="text/css" href="style.css"> -->
</head>
<body>
<div id="navBar">
<!-- logo -->
<span id="logo">
<a href="index.html"> <img src="Cocktail_Maker.svg" height="100%"></a>
</span>
<span id="links">
<!-- About -->
<span class="navBox">
<a href="about.html"> About </a>
</span>
</div>
<div id = "Register">
<p class = "reg">Register</p>
<form method = "POST" action = "../auth/login">
</form>
</div>
<div id="Login">
<p class="sign">Sign in</p>
<form method="POST" action="/api/user/login">
<input class="un" type="text" name="username" placeholder="Username">
<input class="pass" name="password" type="password" placeholder="Password">
<button type="submit" type = "submit">Sign in</a>
</form>
</div>
</body>
<script>
async function handleSubmit () {
//...
// alert("What is up");
// Make the login API call
// var usernm = document.getElementsByName('username')[0].value;
// var pw = document.getElementsByName('password')[0].value;
// alert(usernm);
// alert(pw);
// let data = {
// username:usernm,
// password:pw
// }
// var request = new Request('http://localhost:3000/api/user/login?', {
// method: 'POST',
// body: data,
// headers: new Headers()
// });
// fetch(request).then(msg => console.log(msg))
// await fetch('http://localhost:3000/api/user/login?' + 'username=' + usernm + '&password=' + pw, {
// // method: 'POST', body: {
// method:'POST'
// // username:usernm,
// // password:pw
// // }
// }).then(response => console.log(response));
// //...
// console.log("hello");
// // Extract the JWT from the response
// const { jwt_token } = await response.json()
// console.log(jwt_token);
// //...
// // Do something the token in the login method
// // await login({ jwt_token })
// // inMemoryToken = {
// // token: jwt_token,
// // expiry: jwt_token_expiry
// // };
// // if (!noRedirect) {
// // Router.push('/app')
// // }
}
</script>
</html>