From 88fed0af0a11c6c7b333a4ee0a4f0183198ea861 Mon Sep 17 00:00:00 2001 From: ezequiel Date: Fri, 24 Jan 2014 00:21:43 -0300 Subject: [PATCH] api rest call --- .../com/wisemapping/dao/UserManagerImpl.java | 4 +--- .../src/main/webapp/jsp/accountSettings.jsp | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java b/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java index e43ff3ed..5bac8dc3 100644 --- a/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java @@ -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(); } diff --git a/wise-webapp/src/main/webapp/jsp/accountSettings.jsp b/wise-webapp/src/main/webapp/jsp/accountSettings.jsp index 7e08e920..7d826b0a 100755 --- a/wise-webapp/src/main/webapp/jsp/accountSettings.jsp +++ b/wise-webapp/src/main/webapp/jsp/accountSettings.jsp @@ -159,8 +159,21 @@ $('#deleteAccountForm').submit(function (event) { var locale = $('#deleteAccountForm option:selected').val(); - - postChange("c/restful/account/locale", locale, 'deleteAccountMsg', ""); +//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(); });