Skip to content

Commit

Permalink
docs(pre-auth-hook): clarify .then nesting with comment
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Jan 5, 2017
1 parent 5899eda commit a020b7a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/config/store/pre-auth-hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function onStorePreAuth (request, reply) {

return server.plugins.account.api.sessions.find(sessionToken)

// we have to nest the .then callback here because of the `return`
// statements above. If we would chain the .then below outside of this
// `.then`, then it would be executed after the two `return` statements
// above and cause `reply` to be called twice
.then(function (session) {
delete request.headers.authorization
request.headers.cookie = 'AuthSession=' + session.id
Expand Down

0 comments on commit a020b7a

Please sign in to comment.