Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

Commit

Permalink
Attempt to get token right away. (#252)
Browse files Browse the repository at this point in the history
* Attempt to get token right away.

This makes it so that we don’t have to wait for an async response in order to start making authenticated requests.

* Also set up localStorage.
  • Loading branch information
marshallswain authored and ekryski committed Aug 9, 2016
1 parent 02e0682 commit 880ca97
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export default function(opts = {}) {
app.set('storage', getStorage(config.storage));
}

getJWT(config.tokenKey, config.cookie, this.get('storage')).then(token => {
app.set('token', token);
app.get('storage').setItem(config.tokenKey, token);
});

app.authenticate = function(options = {}) {
const storage = this.get('storage');
let getOptions = Promise.resolve(options);
Expand Down

0 comments on commit 880ca97

Please sign in to comment.