mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
fix(utils): apiFetch should tolerate missing authentication
Signed-off-by: Katalina Okano <git@kat.cafe>
This commit is contained in:
parent
6d8f40e30e
commit
91c27f6b9a
1 changed files with 1 additions and 4 deletions
|
@ -28,15 +28,12 @@ export const apiFetch = async <T>(
|
|||
context?: NextPageContext
|
||||
): Promise<T | null> => {
|
||||
const sessionKey = getSessionKey(context);
|
||||
if (!sessionKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const authorizedInit: RequestInit = {
|
||||
...(init || {}),
|
||||
headers: {
|
||||
...(init?.headers || {}),
|
||||
authorization: `Bearer ${sessionKey}`,
|
||||
authorization: sessionKey ? `Bearer ${sessionKey}` : '',
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue