api rest call

This commit is contained in:
ezequiel 2014-01-24 00:21:43 -03:00
parent 4f40431d55
commit 88fed0af0a
2 changed files with 16 additions and 5 deletions

View File

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

View File

@ -159,8 +159,21 @@
$('#deleteAccountForm').submit(function (event) { $('#deleteAccountForm').submit(function (event) {
var locale = $('#deleteAccountForm option:selected').val(); var locale = $('#deleteAccountForm option:selected').val();
//FIXME: este metodo hay que unificarlo con postChange, con callbacks o eventos para los success and error y pasandole el type
postChange("c/restful/account/locale", locale, 'deleteAccountMsg', "<spring:message code="INFO_UPDATE_SUCCESS"/>"); 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(); event.preventDefault();
}); });