-
Notifications
You must be signed in to change notification settings - Fork 12
/
index.html
61 lines (59 loc) · 1.83 KB
/
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
<html>
<head>
<script src="./dist/api/functional/nestia/index.js"></script>
<script>
window.onload = () => {
console.log(nestiaTest);
document.getElementById('loginButton').addEventListener('click', () => {
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
fetch('http://127.0.0.1:3000/api/auth/login', {
method: 'POST',
body: JSON.stringify({
email: email,
password: password,
}),
headers: {
'Content-Type': 'application/json',
},
})
.then((res) => res.json())
.then((res) => {
console.log('res : ', res);
})
.catch((err) => {
console.log('err : ', err);
});
});
// async function login() {
// try {
// const response = await fetch(
// 'http://127.0.0.1:3000/api/auth/login',
// {
// method: 'POST',
// headers: {
// accept: '*/*',
// 'Content-Type': 'application/json',
// },
// data: JSON.stringify({
// email: 'string',
// password: 'string',
// }),
// },
// );
// const data = await response.json();
// console.log(data);
// } catch (err) {
// console.log('err : ', err.message);
// }
// }
// login();
};
</script>
</head>
<body>
<input id="email" type="text" placeholder="email" />
<input id="password" type="text" placeholder="password" />
<button id="loginButton">login</button>
</body>
</html>