mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2025-01-26 17:36:28 -07:00
fix: not logged in clients send correct header
This commit is contained in:
parent
a23b24e9cc
commit
8c641f0fbd
1 changed files with 2 additions and 2 deletions
|
@ -32,7 +32,7 @@ export const api = ((endpoint: string, data: Record<string, any> = {}, token?: s
|
||||||
body: JSON.stringify(data),
|
body: JSON.stringify(data),
|
||||||
credentials: 'omit',
|
credentials: 'omit',
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: { authorization },
|
headers: authorization ? { authorization } : {},
|
||||||
}).then(async (res) => {
|
}).then(async (res) => {
|
||||||
const body = res.status === 204 ? null : await res.json();
|
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',
|
method: 'GET',
|
||||||
credentials: 'omit',
|
credentials: 'omit',
|
||||||
cache: 'default',
|
cache: 'default',
|
||||||
headers: { authorization },
|
headers: authorization ? { authorization } : {},
|
||||||
}).then(async (res) => {
|
}).then(async (res) => {
|
||||||
const body = res.status === 204 ? null : await res.json();
|
const body = res.status === 204 ? null : await res.json();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue