diff --git a/src/register.html b/src/register.html
index 130b002..8064af1 100644
--- a/src/register.html
+++ b/src/register.html
@@ -37,18 +37,23 @@
mode: "cors"
}).then(res => {
if (res.status === 200) {
- let temp = res.json();
- if(temp.result === 'error'){
- document.getElementById('formStatus').innerHTML = `${temp.error}`;
- } else {
- document.getElementById('formStatus').innerHTML = "Success";
- }
+ return res.json();
} else if (res.status === 500) {
document.getElementById('formStatus').innerHTML = "Failure";
} else {
document.getElementById('formStatus').innerHTML = "Failure: Failed to communicate to server";
}
- }).catch(() => document.getElementById('formStatus').innerHTML = "Please try again")
+ })
+ .then((temp) => {
+ if(temp){
+ if(temp.result === 'error'){
+ document.getElementById('formStatus').innerHTML = `${temp.error}`;
+ } else {
+ document.getElementById('formStatus').innerHTML = "Success";
+ }
+ }
+ })
+ .catch(() => document.getElementById('formStatus').innerHTML = "Please try again")
}