[pass-reset_script] Removing TODOs re. alerts, adding todo to change the url in the post and code in check
This commit is contained in:
parent
51ac57ebf0
commit
6d50144248
1 changed files with 3 additions and 4 deletions
|
@ -23,11 +23,13 @@ formEl.addEventListener('submit', () => {
|
|||
formData.append("field", "password");
|
||||
formData.append("value", newPW);
|
||||
const object = Object.fromEntries(formData.entries());
|
||||
//TODO: Change this to use our api
|
||||
fetch('https://reqres.in/api/update', {
|
||||
method: 'POST',
|
||||
body: object
|
||||
}).then(res => {
|
||||
if(res.status === 200) {
|
||||
//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 === 201) {
|
||||
document.getElementById('formStatus').innerHTML = "<span style='background-color: green; color: white'>Success</span>";
|
||||
} else if (res.status === 500){
|
||||
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure</span>";
|
||||
|
@ -35,10 +37,7 @@ formEl.addEventListener('submit', () => {
|
|||
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: Failed to communicate to server</span>";
|
||||
}
|
||||
}).catch(error => document.getElementById('formStatus').innerHTML = "<span style='background-color: yellow; color: black'>Please try again</span>");
|
||||
//TODO: Change this to changing a div in html
|
||||
//alert("Success");
|
||||
} else {
|
||||
//TODO: Change this to changing a div in html
|
||||
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Failure: new passwords don't match</span>";
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue