refactor(js): do not redundantly pass field name
This commit is contained in:
parent
adb2cdfc41
commit
9acb4eb28c
@ -70,8 +70,7 @@ FIELDS = ['username', 'old_password', 'new_password']
|
|||||||
function mapFields(thunk) {
|
function mapFields(thunk) {
|
||||||
for (fieldIndex in FIELDS) {
|
for (fieldIndex in FIELDS) {
|
||||||
const fieldName = FIELDS[fieldIndex]
|
const fieldName = FIELDS[fieldIndex]
|
||||||
const field = document.querySelectorAll(`input[name=${fieldName}]`)[0];
|
thunk(document.querySelector(`input[name=${fieldName}]`))
|
||||||
thunk(field, fieldName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,8 +83,8 @@ function clearFields() {
|
|||||||
function changePasswords() {
|
function changePasswords() {
|
||||||
const query = {};
|
const query = {};
|
||||||
|
|
||||||
mapFields((field, fieldName) => {
|
mapFields(field => {
|
||||||
query[fieldName] = field.value;
|
query[field.name] = field.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
showModal("Wait");
|
showModal("Wait");
|
||||||
|
Loading…
Reference in New Issue
Block a user