Pony.fm/public/scripts/app/services/favourites.coffee

13 lines
310 B
CoffeeScript
Raw Normal View History

2013-08-01 10:57:08 +02:00
angular.module('ponyfm').factory('favourites', [
'$rootScope', '$http'
($rootScope, $http) ->
self =
toggle: (type, id) ->
def = new $.Deferred()
$http.post('/api/web/favourites/toggle', {type: type, id: id, _token: pfm.token}).success (res) ->
def.resolve res
def.promise()
self
])