Skip to content

Commit

Permalink
fix: sets current user on sign up and sign in
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwicopple committed Oct 12, 2020
1 parent 9462e4b commit 787bffb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ export default class Client {

private _saveSession(session: Session) {
this.currentSession = session
this.currentUser = session.user
let tokenExpirySeconds = session['expires_in']

if (this.autoRefreshToken && tokenExpirySeconds) {
Expand Down Expand Up @@ -287,7 +288,7 @@ export default class Client {
this._removeSession()
} else {
this.currentSession = currentSession
this.currentUser = currentSession.user
this.currentUser = currentUser
// schedule a refresh 60 seconds before token due to expire
setTimeout(this._callRefreshToken, (expiresAt - timeNow - 60) * 1000)
}
Expand Down

0 comments on commit 787bffb

Please sign in to comment.