From 91c27f6b9acb4bb7e7f0ef3c66e2019c1e4d99be Mon Sep 17 00:00:00 2001 From: Katalina Okano Date: Mon, 21 Dec 2020 05:04:12 -0500 Subject: [PATCH] fix(utils): apiFetch should tolerate missing authentication Signed-off-by: Katalina Okano --- src/common/utils/isomorphicFetch.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/common/utils/isomorphicFetch.ts b/src/common/utils/isomorphicFetch.ts index 6a37bc6..00d1b78 100644 --- a/src/common/utils/isomorphicFetch.ts +++ b/src/common/utils/isomorphicFetch.ts @@ -28,15 +28,12 @@ export const apiFetch = async ( context?: NextPageContext ): Promise => { const sessionKey = getSessionKey(context); - if (!sessionKey) { - return null; - } const authorizedInit: RequestInit = { ...(init || {}), headers: { ...(init?.headers || {}), - authorization: `Bearer ${sessionKey}`, + authorization: sessionKey ? `Bearer ${sessionKey}` : '', }, };