don't send authenticated request when the user is not authenticated

This commit is contained in:
Abi Raja 2023-12-15 12:57:36 -05:00
parent dcb0116c06
commit 54017dbcd9

View File

@ -11,6 +11,8 @@ export const useAuthenticatedFetch = () => {
body: object | null | undefined = null body: object | null | undefined = null
) => { ) => {
const accessToken = await getToken(); const accessToken = await getToken();
if (!accessToken) return;
const headers: HeadersInit = { const headers: HeadersInit = {
"Content-Type": "application/json", "Content-Type": "application/json",
Authorization: `Bearer ${accessToken}`, Authorization: `Bearer ${accessToken}`,