Skip to content

Commit

Permalink
Fix headers promise (#17)
Browse files Browse the repository at this point in the history
* bearer returns a promise rather than awaiting
  • Loading branch information
freekrai committed Nov 30, 2022
1 parent c40a2f6 commit 7413456
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,11 @@ class Plugin {
Object.assign(headers, (await this.options.headers()) || {});
}

if (this.directus.auth.token) {
const token = await this.directus.auth.token;

if (token) {
Object.assign(headers, {
Authorization: `Bearer ${this.directus.auth.token}`,
Authorization: `Bearer ${token}`,
});
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@directus/gatsby-source-directus",
"version": "9.14.6",
"version": "9.14.7",
"description": "Source plugin for pulling data into Gatsby from a Directus API.",
"author": "João Biondo <wolfulus@gmail.com>",
"license": "MIT",
Expand Down

0 comments on commit 7413456

Please sign in to comment.