[Sign-up_script] Script should call out api service
This commit is contained in:
parent
76a28c9995
commit
d921d6967f
1 changed files with 2 additions and 4 deletions
|
@ -11,13 +11,11 @@ function formHandler(listener){
|
||||||
formData.append("field", "password");
|
formData.append("field", "password");
|
||||||
formData.append("value", newPW);
|
formData.append("value", newPW);
|
||||||
const object = Object.fromEntries(formData.entries());
|
const object = Object.fromEntries(formData.entries());
|
||||||
//TODO: Change this to use our api
|
fetch('https://api.sso.skynet.ie/ldap/update', {
|
||||||
fetch('https://reqres.in/api/update', {
|
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: object
|
body: object
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
//TODO: Change success to use 200 rather than 201 (This is the code that the api testing service uses for the chosen api)
|
if(res.status === 200) {
|
||||||
if(res.status === 201) {
|
|
||||||
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
|
||||||
} else if (res.status === 500){
|
} else if (res.status === 500){
|
||||||
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure</span>";
|
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure</span>";
|
||||||
|
|
Loading…
Reference in a new issue