diff --git a/src/client-libs/index.js b/src/client-libs/index.js index 905408e..0e655c3 100644 --- a/src/client-libs/index.js +++ b/src/client-libs/index.js @@ -113,11 +113,13 @@ app.controller('MailboxController', ["$interval", "$http", "$log", function ($in }); }; - self.deleteMail = function (mailid, index) { + self.deleteMail = function (mail, index) { // instantly remove from frontend. self.mails.splice(index, 1); + // remove on backend. - $http.get(backend_url, {params: {username: self.username, delete_email_id: mailid}}) + var firstTo = Object.keys(mail.to)[0]; + $http.get(backend_url, {params: {username: firstTo, delete_email_id: mail.id}}) .then( function successCallback(response) { self.updateMails(); diff --git a/src/index.html b/src/index.html index 288fecd..9159a12 100644 --- a/src/index.html +++ b/src/index.html @@ -86,7 +86,7 @@ download="true">Download -