From 5466f547cd056d9e3a1a66d332137450034c42e6 Mon Sep 17 00:00:00 2001 From: Johann150 Date: Wed, 20 Jul 2022 18:40:23 +0200 Subject: [PATCH] fix: not logged in clients send correct header --- packages/client/src/os.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/src/os.ts b/packages/client/src/os.ts index 9defc55df..ecf422a56 100644 --- a/packages/client/src/os.ts +++ b/packages/client/src/os.ts @@ -32,7 +32,7 @@ export const api = ((endpoint: string, data: Record = {}, token?: s body: JSON.stringify(data), credentials: 'omit', cache: 'no-cache', - headers: { authorization }, + headers: authorization ? { authorization } : {}, }).then(async (res) => { const body = res.status === 204 ? null : await res.json(); @@ -69,7 +69,7 @@ export const apiGet = ((endpoint: string, data: Record = {}, token? method: 'GET', credentials: 'omit', cache: 'default', - headers: { authorization }, + headers: authorization ? { authorization } : {}, }).then(async (res) => { const body = res.status === 204 ? null : await res.json();