Skip to content

Instantly share code, notes, and snippets.

What would you like to do? with promise
save: (data, options = {}) ->
entity = @
isNew = @isNew()
success = _.bind(@saveSuccess, @, isNew, options.collection, options.callback)
error = _.bind(@saveError, @)
promise = new Promise (resolve, reject) ->
_.defaults options,
wait: true
success: ->
success.apply(@, arguments)
error: (entity, response) ->
App.log.error('API Sync Error in loadRelations():', response)
error.apply(@, arguments)
#reject(new Error('API Sync Error in relations'))
err = new Error('API Sync Error ')
err.response = response
super(data, options)
return promise
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.