Skip to content

Commit b2cf2d8

Browse files
committed
feat: Pass STAC-API options to context
1 parent 99d326e commit b2cf2d8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/context/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { createContext } from 'react';
44
import StacApi from '../stac-api';
55
import useStacApi from '../hooks/useStacApi';
66
import type { CollectionsResponse } from '../types/stac';
7+
import { GenericObject } from '../types';
78

89
type StacApiContextType = {
910
stacApi?: StacApi;
@@ -13,13 +14,14 @@ type StacApiContextType = {
1314

1415
type StacApiProviderType = {
1516
apiUrl: string;
16-
children: React.ReactNode
17+
children: React.ReactNode;
18+
options?: GenericObject;
1719
}
1820

1921
export const StacApiContext = createContext<StacApiContextType>({} as StacApiContextType);
2022

21-
export function StacApiProvider({ children, apiUrl }: StacApiProviderType) {
22-
const { stacApi } = useStacApi(apiUrl);
23+
export function StacApiProvider({ children, apiUrl, options }: StacApiProviderType) {
24+
const { stacApi } = useStacApi(apiUrl, options);
2325
const [ collections, setCollections ] = useState<CollectionsResponse>();
2426

2527
const contextValue = useMemo(() => ({

0 commit comments

Comments
 (0)