Skip to content

Commit

Permalink
WIP – set authorization header for hoodie.store on signin
Browse files Browse the repository at this point in the history
* * *

This commit was sponsored by &yet.

Our friends at &yet have been supporters of Hoodie since its earliest days. <3
And they have availability for new projects! We think they’re some of the best
people you can hire anywhere, but you can read what other people have to say
about them and their work here:

https://andyet.com/case-studies/
  • Loading branch information
gr2m committed Dec 23, 2015
1 parent ef275b1 commit c9b1dd3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function Hoodie (options) {
api.off = require('./lib/events').off.bind(this, state)
api.trigger = require('./lib/events').trigger.bind(this, state)

api.account.on('signin', function (session) {
api.store.db.__opts.ajax.headers.authorization = 'Bearer ' + session.id
api.account.on('signin', function (account) {
api.store.db.__opts.ajax.headers.authorization = 'Bearer ' + account.session.id
})
api.account.on('signout', function () {
delete api.store.db.__opts.ajax.headers.authorization
Expand Down

0 comments on commit c9b1dd3

Please sign in to comment.