Result status handling complete
Signed-off-by: Eoghan Conlon <eoghanconlon73@skynet.ie>
This commit is contained in:
parent
0b3eaacef6
commit
05b05833f6
1 changed files with 8 additions and 0 deletions
|
@ -38,6 +38,14 @@
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify(object),
|
body: JSON.stringify(object),
|
||||||
mode: "cors"
|
mode: "cors"
|
||||||
|
}).then(res => {
|
||||||
|
if(res.status === 200){
|
||||||
|
return res.json();
|
||||||
|
} else if (res.status === 500){
|
||||||
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure</span>";
|
||||||
|
} else {
|
||||||
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: Failed to communicate to server</span>";
|
||||||
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: Passwords don't match</span>";
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: Passwords don't match</span>";
|
||||||
|
|
Loading…
Reference in a new issue