File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -23,8 +23,12 @@ function QueryBuilder ({
2323
2424 const handleRangeFromChange = useCallback ( ( e ) => setDateRangeFrom ( e . target . value ) , [ setDateRangeFrom ] ) ;
2525 const handleRangeToChange = useCallback ( ( e ) => setDateRangeTo ( e . target . value ) , [ setDateRangeTo ] ) ;
26+
27+ const headers = useMemo ( ( ) => ( {
28+ Authorization : "Basic " + btoa ( process . env . REACT_APP_STAC_API_TOKEN + ":" )
29+ } ) , [ ] ) ;
2630
27- const stacApi = useMemo ( ( ) => new StacApi ( process . env . REACT_APP_STAC_API ) , [ ] ) ;
31+ const stacApi = useMemo ( ( ) => new StacApi ( process . env . REACT_APP_STAC_API , { headers } ) , [ headers ] ) ;
2832 const { collections } = useCollections ( stacApi ) ;
2933
3034 const collectionOptions = useMemo (
Original file line number Diff line number Diff line change 1- import { useCallback , useState } from "react" ;
1+ import { useCallback , useState , useMemo } from "react" ;
22import { useStacSearch , StacApi } from "stac-react" ;
33
44import ItemList from "./ItemList" ;
@@ -7,7 +7,11 @@ import QueryBuilder from "./QueryBuilder";
77
88function Main ( ) {
99 const [ isBboxDrawEnabled , setIsBboxDrawEnabled ] = useState ( false ) ;
10- const stacApi = new StacApi ( process . env . REACT_APP_STAC_API ) ;
10+ const headers = useMemo ( ( ) => ( {
11+ Authorization : "Basic " + btoa ( process . env . REACT_APP_STAC_API_TOKEN + ":" )
12+ } ) , [ ] ) ;
13+
14+ const stacApi = new StacApi ( process . env . REACT_APP_STAC_API , { headers } ) ;
1115 const {
1216 setBbox,
1317 collections,
You can’t perform that action at this time.
0 commit comments