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",
|
||||
icon_url : "checkmark.svg",
|
||||
},
|
||||
"FillAllFields" : {
|
||||
button_disabled : false,
|
||||
message : "You have to fill all three input fields",
|
||||
icon_url : "cross.svg",
|
||||
},
|
||||
"FetchError" : {
|
||||
button_disabled : false,
|
||||
message : "An error occurred while contacting the server",
|
||||
@ -82,6 +87,11 @@ function clearFields() {
|
||||
function changePasswords() {
|
||||
const query = {};
|
||||
|
||||
if(!fields().every(field.value.length != 0)) {
|
||||
showModal("FillAllFields");
|
||||
return;
|
||||
}
|
||||
|
||||
fields().forEach(field => {
|
||||
query[field.name] = field.value;
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user