')
tagTable.append($rowTag).append($labelCell).append($checkBoxCell);
});
function showSuccess() {
if (!isEmailSubmitPending && !isTagSubmitPending && !hasError)
{
form.find('.notice-success').show();
}
}
//cleverness could eliminate some mild DRY violations below
form.submit(function(e) {
//remove below obv
// return false;
e.preventDefault();
form.find('.notice').hide();
hasError = false;
isEmailSubmitPending = true;
isTagSubmitPending = true;
//do email edit
var url = 'http://localhost:8080/user/email/edit?auth_token=' + userAuthToken,
//Did not test below but should be close to this, it may need to be scrubbed and/or modified.
formData = emailSection.find(':input').serialize();
fetch(url, {
method: "POST",
body: formData
}).then(function(value) {
isEmailSubmitPending = false;
showSuccess();
}).catch(function(value) {
isEmailSubmitPending = false;
hasError = true;
var error = "get actual error message from value";
emailSection.find('.notice-error').html(error).show();
});
//do tag edit
var url = 'http://localhost:8080/user/fix/me?auth_token=' + userAuthToken,
//Did not test below but should be close to this, it may need to be scrubbed and/or modified.
formData = tagSection.find(':input').serialize();
fetch(url, {
method: "POST",
body: formData
}).then(function(value) {
isTagSubmitPending = false;
showSuccess();
}).catch(function(value) {
isTagSubmitPending = false;
hasError = true;
var error = "get actual error message from value";
tagSection.find('.notice-error').html(error).show();
});
});
form.show();
}