88 js using showFeedbackMessage

This commit is contained in:
Artem.Arefev 2019-05-17 12:23:45 +04:00
parent 64357c2508
commit 740adc5318

View File

@ -17,17 +17,42 @@ function changePassword() {
url:"/api/1.0/users/changePassword", url:"/api/1.0/users/changePassword",
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
data: JSON.stringify({ data: JSON.stringify({
"oldPassword": oldPassword, "oldPassword": document.getElementById("oldPassword").value,
"password": password, "password": document.getElementById("password").value,
"confirmPassword": confirmPassword, "confirmPassword": document.getElementById("confirmPassword").value,
}), }),
method: "POST", method: "POST",
success: function() { success: function() {
document.getElementById("closeModalPassword").click(); document.getElementById("closeModalPassword").click();
alert("Пароль был обновлен"); showFeedbackMessage("Пароль был обновлен", MessageTypesEnum.SUCCESS)
}, },
error: function(errorData) { error: function(errorData) {
alert(errorData.responseJSON.error.message) showFeedbackMessage(errorData.responseJSON.error.message, MessageTypesEnum.WARNING)
}
})
}
function inviteUser() {
email = document.getElementById("email").value;
re = /\S+@\S+\.\S+/;
if (!re.test(email)) {
alert("Некорректный почтовый ящик")
return;
}
$.ajax({
url:"/api/1.0/users/invite?email=" + email,
contentType: "application/json; charset=utf-8",
method: "POST",
success: function() {
document.getElementById("closeModalInvite").click();
showFeedbackMessage("Пользователь был успешно приглашен", MessageTypesEnum.SUCCESS)
},
error: function(errorData) {
showFeedbackMessage(errorData.responseJSON.error.message, MessageTypesEnum.WARNING)
} }
}) })
} }