From 74134564079636050e9dda98fd3a1fc9ab85005a Mon Sep 17 00:00:00 2001 From: Roger Stringer Date: Wed, 30 Nov 2022 10:39:09 -0800 Subject: [PATCH] Fix headers promise (#17) * bearer returns a promise rather than awaiting --- gatsby-node.js | 6 ++++-- package.json | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index 0292ced..eff7b6b 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -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}`, }); } diff --git a/package.json b/package.json index ed129eb..67eaf96 100644 --- a/package.json +++ b/package.json @@ -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 ", "license": "MIT",