mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
21 lines
587 B
CoffeeScript
21 lines
587 B
CoffeeScript
angular.module("Darkswarm").factory 'Customer', ($resource, RailsFlashLoader) ->
|
|
Customer = $resource('/api/customers/:id/:action.json', {}, {
|
|
'index':
|
|
method: 'GET'
|
|
isArray: true
|
|
'update':
|
|
method: 'PUT'
|
|
params:
|
|
id: '@id'
|
|
transformRequest: (data, headersGetter) ->
|
|
angular.toJson(customer: data)
|
|
})
|
|
|
|
Customer.prototype.update = ->
|
|
@$update().then (response) =>
|
|
RailsFlashLoader.loadFlash({success: t('js.changes_saved')})
|
|
, (response) =>
|
|
RailsFlashLoader.loadFlash({error: response.data.error})
|
|
|
|
Customer
|