Skip to content

Commit

Permalink
fix: client signOut doesn't trigger api.signOut #73
Browse files Browse the repository at this point in the history
  • Loading branch information
phamhieu committed Apr 12, 2021
1 parent 6c68782 commit 155ae0d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/GoTrueClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,11 @@ export default class GoTrueClient {
* For server-side management, you can disable sessions by passing a JWT through to `auth.api.signOut(JWT: string)`
*/
async signOut(): Promise<{ error: Error | null }> {
const accessToken = this.currentSession?.access_token
this._removeSession()
this._notifyAllSubscribers('SIGNED_OUT')
if (this.currentSession) {
const { error } = await this.api.signOut(this.currentSession.access_token)
if (accessToken) {
const { error } = await this.api.signOut(accessToken)
if (error) return { error }
}
return { error: null }
Expand Down

0 comments on commit 155ae0d

Please sign in to comment.