diff --git a/public/js/app/controllers/TimelineSubscribersController.js b/public/js/app/controllers/TimelineSubscribersController.js index 5fad3ff..a6a4f3b 100644 --- a/public/js/app/controllers/TimelineSubscribersController.js +++ b/public/js/app/controllers/TimelineSubscribersController.js @@ -1,22 +1,31 @@ -define(["app/app", +define(["config", + "app/app", "ember", - "controllers/ApplicationController"], function(App, Ember) { + "controllers/ApplicationController"], function(config, App, Ember) { "use strict"; - App.TimelineSubscribersController = App.ApplicationController.extend({ - isEdit: false, + App.TimelineSubscribersController = App.ApplicationController.extend({ + isEdit: false, - actions: { - removeSubscriber: function(username) { - }, + actions: { + removeSubscriber: function(user) { + Ember.$.ajax({ + url: config.host + '/v1/users/' + user.get('username') + '/unsubscribeFromMe', + type: 'post', + context: this + }) + .then(function(response) { + this.get('model').removeObject(user) + }) + }, - manage: function() { - this.set('isEdit', true) - }, + manage: function() { + this.set('isEdit', true) + }, - browse: function() { - this.set('isEdit', false) - } - } + browse: function() { + this.set('isEdit', false) + } + } }) })