Created
August 1, 2015 11:42
-
-
Save AmilKey/f08c974eba9872f1b2b2 to your computer and use it in GitHub Desktop.
add open-key before load ember app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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