Fixed bug where we were not submitting multiple emails when users had multiple registered for lbry inc.

This commit is contained in:
Mark Beamer Jr 2018-09-13 11:56:41 -04:00
parent 22e4fa6aeb
commit 954b8d3454
No known key found for this signature in database
GPG key ID: 1C314FB89AD76973

View file

@ -20,24 +20,24 @@ lbry.emailSettingsForm = function (formSelector, tags, userAuthToken) {
hasError = false;
isEmailSubmitPending = true;
isTagSubmitPending = true;
var url = 'https://api.lbry.io/user/email/edit?auth_token=' + userAuthToken
$.param($.map(emailSection.find("input"), function(element) {
var promiseMap = $.map(emailSection.find("input"), function(element) {
var url = 'https://api.lbry.io/user/email/edit?auth_token=' + userAuthToken
url = url + "&email="+element.value+"&enabled="+element.checked.toString();
fetch(url).then(function(value) { return value.json()}).then(jsonResponse => {
return fetch(url).then(function(value) { return value.json()})
});
//Call api for each email a user will have linked - polyfill needed for IE for Promise.all
Promise.all(promiseMap)
.then(function(apiValues) {
isEmailSubmitPending = false;
if (!jsonResponse.success){
hasError = true
emailSection.find('.notice-error').html(jsonResponse.error).show();
}
showSuccess();
}).catch(function(value) {
})
.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 = 'https://api.lbry.io/user/tag/edit?auth_token=' + userAuthToken