diff --git a/src/api/getOrgLogo.ts b/src/api/getOrgLogo.ts index 48dbc67..a08516d 100644 --- a/src/api/getOrgLogo.ts +++ b/src/api/getOrgLogo.ts @@ -1,7 +1,15 @@ import { API_URL } from "constants/envVariables"; +import { getSdpTenantName } from "helpers/getSdpTenantName"; -export async function getOrgLogo(): Promise { - const response = await fetch(`${API_URL}/organization/logo`); +export async function getOrgLogo(token: string): Promise { + const response = await fetch(`${API_URL}/organization/logo`, { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + "SDP-Tenant-Name": getSdpTenantName(), + }, + }); const responseBlob = await response.blob(); return URL.createObjectURL(responseBlob); diff --git a/src/store/ducks/organization.ts b/src/store/ducks/organization.ts index 9867e8b..297d207 100644 --- a/src/store/ducks/organization.ts +++ b/src/store/ducks/organization.ts @@ -79,19 +79,23 @@ export const getOrgLogoAction = createAsyncThunk< string, undefined, { rejectValue: RejectMessage; state: RootState } ->("organization/getOrgLogoAction", async (_, { rejectWithValue, dispatch }) => { - try { - return await getOrgLogo(); - } catch (error: unknown) { - const apiError = normalizeApiError(error as ApiError); - const errorString = apiError.message; - endSessionIfTokenInvalid(errorString, dispatch); +>( + "organization/getOrgLogoAction", + async (_, { rejectWithValue, getState, dispatch }) => { + const { token } = getState().userAccount; + try { + return await getOrgLogo(token); + } catch (error: unknown) { + const apiError = normalizeApiError(error as ApiError); + const errorString = apiError.message; + endSessionIfTokenInvalid(errorString, dispatch); - return rejectWithValue({ - errorString: `Error fetching organization logo: ${errorString}`, - }); - } -}); + return rejectWithValue({ + errorString: `Error fetching organization logo: ${errorString}`, + }); + } + }, +); export const getStellarAccountAction = createAsyncThunk< StellarAccountInfo,