Skip to content

Instantly share code, notes, and snippets.

@AmilKey
Created August 1, 2015 11:42
Show Gist options
  • Select an option

  • Save AmilKey/f08c974eba9872f1b2b2 to your computer and use it in GitHub Desktop.

Select an option

Save AmilKey/f08c974eba9872f1b2b2 to your computer and use it in GitHub Desktop.
add open-key before load ember app
Em.onLoad 'Ember.Application', (application)->
application.initializer
name: 'OpenKey'
initialize: (container, app)->
app.deferReadiness()
url = "#{app.CONFIG.API.host}/open-key"
Ember.$.ajax
url: url
method: "GET"
success: (result, textStatus, jqXHR) ->
openKey = jqXHR.getResponseHeader("Open-Key")
container.lookup('adapter:application').saveHeaders openKey #Add private key
app.advanceReadiness()
return
error: ->
console.log arguments
return
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment