Arcader7171 commited on
Commit
4e363c4
·
verified ·
1 Parent(s): 4afe2b2

Update static/scripts/login.js

Browse files
Files changed (1) hide show
  1. static/scripts/login.js +10 -9
static/scripts/login.js CHANGED
@@ -8,15 +8,16 @@ function login() {
8
  body: JSON.stringify({"username": userInput.value, "password": passInput.value})
9
  })
10
  .then((response) => {
11
- if (response.status == 401) {
12
- alert(`Error - ${response.statusText}`);
13
- return;
14
- } else if (!response.ok) {
15
- return;
16
- } else if (response.ok) {
17
- alert("Successful")
18
- // window.location.reload();
19
- }
 
20
  })
21
  }
22
 
 
8
  body: JSON.stringify({"username": userInput.value, "password": passInput.value})
9
  })
10
  .then((response) => {
11
+ let data = response.json()
12
+ if (response.status == 401) {
13
+ alert(`Error - ${data.message}`);
14
+ return;
15
+ } else if (!response.ok) {
16
+ return;
17
+ } else if (response.ok) {
18
+ alert("Successful")
19
+ // window.location.reload();
20
+ }
21
  })
22
  }
23