Skip to content

Commit

Permalink
Allow jwt to take null or undefined
Browse files Browse the repository at this point in the history
Minor change, but I've had to do this in my code which I'm not a big fan of:

`api.jwt(getToken().accessToken || null)`
  • Loading branch information
akmjenkins committed Feb 15, 2019
1 parent 823b7ee commit 255ebfe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class Frisbee {
}

jwt(token) {
if (token === null) delete this.headers.Authorization;
if (token === null || token === undefined) delete this.headers.Authorization;
else if (typeof token === 'string')
this.headers.Authorization = `Bearer ${token}`;
else throw new TypeError('jwt token must be a string');
Expand Down

0 comments on commit 255ebfe

Please sign in to comment.