Skip to content

Commit

Permalink
feat(logout): allow setting token from param
Browse files Browse the repository at this point in the history
  • Loading branch information
eljefedelrodeodeljefe committed Oct 24, 2019
1 parent 4ca5ff1 commit fd2a2ce
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/v0/auth.ts
Expand Up @@ -232,15 +232,15 @@ export class Auth {
Client.getInstance(clientOptions).setDefaults(clientOptions)
}

public async logout(): Promise<LogoutResponse> {
if (!this.token) {
public async logout(token?: string): Promise<LogoutResponse> {
if (!token && !this.token) {
throw new LogoutMissingToken()
}

try {
const { data } = await axios.get(`${this.options.base}/api/v0/users/logout`, {
headers: {
Authorization: `Bearer ${this.token}`
Authorization: `Bearer ${token || this.token}`
}
})

Expand Down

0 comments on commit fd2a2ce

Please sign in to comment.