api rest call

This commit is contained in:
ezequiel 2014-01-24 00:21:43 -03:00
parent d1004f2919
commit 31aab0bd48
2 changed files with 16 additions and 5 deletions

View File

@ -110,9 +110,7 @@ public class UserManagerImpl
}
@Override
public void deleteUser(@NotNull User user) {
final Collaborator collaborator = this.getCollaboratorBy(user.getEmail());
getHibernateTemplate().delete(collaborator);
public void deleteUser(@NotNull final User user) {
getHibernateTemplate().delete(user);
getHibernateTemplate().flush();
}

View File

@ -159,8 +159,21 @@
$('#deleteAccountForm').submit(function (event) {
var locale = $('#deleteAccountForm option:selected').val();
postChange("c/restful/account/locale", locale, 'deleteAccountMsg', "<spring:message code="INFO_UPDATE_SUCCESS"/>");
//FIXME: este metodo hay que unificarlo con postChange, con callbacks o eventos para los success and error y pasandole el type
jQuery.ajax("c/restful/account", {
async: false,
dataType: 'json',
data: locale,
type: 'DELETE',
contentType: "text/plain; charset=utf-8",
success: function (data, textStatus, jqXHR) {
window.location.href = "/c/logout"
},
error: function (jqXHR, textStatus, errorThrown) {
$('#' + 'deleteAccountMsg').removeClass('alert-info').addClass('alert-error').show();
$('#' + 'deleteAccountMsg').text(textStatus);
}
});
event.preventDefault();
});