feat(js): abort request and show message if any field is empty
This commit is contained in:
parent
aaec961560
commit
694f4bdfd2
@ -25,6 +25,11 @@ MODAL_STATES = {
|
|||||||
message : "Password changed",
|
message : "Password changed",
|
||||||
icon_url : "checkmark.svg",
|
icon_url : "checkmark.svg",
|
||||||
},
|
},
|
||||||
|
"FillAllFields" : {
|
||||||
|
button_disabled : false,
|
||||||
|
message : "You have to fill all three input fields",
|
||||||
|
icon_url : "cross.svg",
|
||||||
|
},
|
||||||
"FetchError" : {
|
"FetchError" : {
|
||||||
button_disabled : false,
|
button_disabled : false,
|
||||||
message : "An error occurred while contacting the server",
|
message : "An error occurred while contacting the server",
|
||||||
@ -82,6 +87,11 @@ function clearFields() {
|
|||||||
function changePasswords() {
|
function changePasswords() {
|
||||||
const query = {};
|
const query = {};
|
||||||
|
|
||||||
|
if(!fields().every(field.value.length != 0)) {
|
||||||
|
showModal("FillAllFields");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fields().forEach(field => {
|
fields().forEach(field => {
|
||||||
query[field.name] = field.value;
|
query[field.name] = field.value;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user