Arcader7171 commited on
Commit
396185f
·
verified ·
1 Parent(s): 75d06f6

Update templates/signin.html

Browse files
Files changed (1) hide show
  1. templates/signin.html +8 -13
templates/signin.html CHANGED
@@ -10,22 +10,17 @@
10
  let passInput = document.getElementById("passInput");
11
 
12
  if (keyName === "Enter") {
13
- const req = new Request("/api/signup", {
14
  method: "POST",
15
- header: new Headers({"Content-Type": "application/json"}),
16
  body: JSON.stringify({username: userInput.value, password: passInput.value})
17
  })
18
-
19
- window
20
- .fetch(req)
21
- .then((response) => {
22
- if (!response.ok) {
23
- alert("Something went wrong");
24
- } else {
25
- alert("All good!");
26
- console.log("All good! Signed up!")
27
- }
28
- })
29
  }
30
  }
31
  )
 
10
  let passInput = document.getElementById("passInput");
11
 
12
  if (keyName === "Enter") {
13
+ const resp = await fetch("/api/signup", {
14
  method: "POST",
15
+ header: {"Content-Type": "application/json"},
16
  body: JSON.stringify({username: userInput.value, password: passInput.value})
17
  })
18
+
19
+ if (!resp.ok) {
20
+ alert("Something went wrong")
21
+ } else {
22
+ alert("All good!")
23
+ }
 
 
 
 
 
24
  }
25
  }
26
  )