21 lines
736 B
CoffeeScript
21 lines
736 B
CoffeeScript
@App = Ember.Application.create
|
|
LOG_TRANSITIONS: true
|
|
rootElement: '#ember-app-container'
|
|
Ember.$.ajaxPrefilter (options) ->
|
|
if options.type.toUpperCase() == 'GET'
|
|
if auth_token = Qstorage.getItem('auth_token')
|
|
if options.data
|
|
options.data += "&auth_token=#{auth_token}"
|
|
else
|
|
options.data = "auth_token=#{auth_token}"
|
|
if options.type.toUpperCase() == 'POST'
|
|
if auth_token = Qstorage.getItem('auth_token')
|
|
options.data ||= {}
|
|
options.data.auth_token = auth_token
|
|
true
|
|
Ember.$.ajaxSetup
|
|
error: (jqXHR, textStatus, errorThrown)->
|
|
console.log "Error: #{textStatus}: #{errorThrown}"
|
|
if jqXHR.status == 401
|
|
App.__container__.lookup('route:application').unauthorized()
|