travis-web/assets/scripts/app/adapters/application.coffee
2015-01-29 13:39:05 +01:00

14 lines
379 B
CoffeeScript

Travis.ApplicationAdapter = DS.ActiveModelAdapter.extend
host: Travis.config.api_endpoint
ajaxOptions: (url, type, options) ->
hash = @_super(url, type, options)
hash.headers ||= {}
hash.headers['accept'] = 'application/json; version=2'
token = Travis.sessionStorage.getItem('travis.token')
hash.headers['Authorization'] ||= "token #{token}"
hash