Pony.fm/resources/assets/scripts/app/services/follow.coffee

14 lines
381 B
CoffeeScript
Raw Normal View History

2015-08-31 17:42:21 +02:00
angular.module('ponyfm').factory('follow', [
2015-10-25 03:35:37 +01:00
'$rootScope', '$http'
($rootScope, $http) ->
self =
toggle: (type, id) ->
def = new $.Deferred()
$http.post('/api/web/follow/toggle', {type: type, id: id, _token: pfm.token}).success (res) ->
def.resolve res
2015-08-31 17:42:21 +02:00
2015-10-25 03:35:37 +01:00
def.promise()
2015-08-31 17:42:21 +02:00
2015-10-25 03:35:37 +01:00
self
])