fix: not logged in clients send correct header

This commit is contained in:
Johann150 2022-07-20 18:40:23 +02:00
parent 2497499d63
commit 5466f547cd
No known key found for this signature in database
GPG key ID: 9EE6577A2A06F8F1

View file

@ -32,7 +32,7 @@ export const api = ((endpoint: string, data: Record<string, any> = {}, 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<string, any> = {}, token?
method: 'GET',
credentials: 'omit',
cache: 'default',
headers: { authorization },
headers: authorization ? { authorization } : {},
}).then(async (res) => {
const body = res.status === 204 ? null : await res.json();