diff --git a/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx b/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx index 38e0c8dfe1..cb35bbda9d 100644 --- a/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx +++ b/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx @@ -5,6 +5,7 @@ import { UseRequestResult, useAPIClient, useRequest } from '../../api-client'; import { CollectionRecordProvider, CollectionRecord } from '../collection-record'; import { AllDataBlockProps, useDataBlockProps } from './DataBlockProvider'; import { useDataBlockResource } from './DataBlockResourceProvider'; +import { useDataSourceHeaders } from '../utils'; export const BlockRequestContext = createContext>(null); BlockRequestContext.displayName = 'BlockRequestContext'; @@ -52,6 +53,8 @@ function useCurrentRequest(options: Omit) { function useParentRequest(options: Omit) { const { sourceId, association, parentRecord } = options; const api = useAPIClient(); + const dataBlockProps = useDataBlockProps(); + const headers = useDataSourceHeaders(dataBlockProps.dataSource); return useRequest( async () => { if (parentRecord) return Promise.resolve({ data: parentRecord }); @@ -60,7 +63,7 @@ function useParentRequest(options: Omit) { const arr = association.split('.'); // :get/ const url = `${arr[0]}:get/${sourceId}`; - const res = await api.request({ url }); + const res = await api.request({ url, headers }); return res.data; }, {