-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Not every STAC-based application will be coupled to a single API. For one example, stac-map is designed to load in arbitrary STAC values (catalogs, collections, items, and item collections), similar to stac-browser. In this case, it's common to navigate back to previously-loaded values, or to pre-fetch values (e.g. a "root" link). In this case, request caching can be a big performance win.
Right now we're doing bare fetch
in stac-react:
stac-react/src/hooks/useStacApi.ts
Lines 17 to 34 in a619465
fetch(url, { | |
headers: { | |
'Content-Type': 'application/json', | |
...options?.headers | |
} | |
}) | |
.then(response => { | |
baseUrl = response.url; | |
return response; | |
}) | |
.then(response => response.json()) | |
.then(response => { | |
const doesPost = response.links.find(({ rel, method }: Link) => rel === 'search' && method === 'POST'); | |
if (doesPost) { | |
searchMode = SearchMode.POST; | |
} | |
}) | |
.then(() => setStacApi(new StacApi(baseUrl, searchMode, options))); |
AliceR
Metadata
Metadata
Assignees
Labels
No labels