Spaces:
Sleeping
Sleeping
Update static/scripts/login.js
Browse files- 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 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 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 |
|