@geogirafe/lib-geoportal
Version:
GeoGirafe is a flexible application to build online geoportals.
20 lines (19 loc) • 794 B
JavaScript
import OgcApiFeaturesClient, { DEMO_INSTANCES } from './ogcapifeaturesclient';
export default class OgcApiFeaturesClientGeorama extends OgcApiFeaturesClient {
constructor(options) {
super(options);
}
/*
Overwrite base method fetch options because the Georama demo server currently only supports basic auth.
*/
getFetchOptions(method = 'GET') {
const fetchOptions = super.getFetchOptions(method);
const headers = new Headers(fetchOptions?.headers);
// POC: Only basic auth for now
headers.set('Authorization', `Basic ${window.btoa(DEMO_INSTANCES.GEORAMA.credentials)}`);
fetchOptions.credentials = 'include';
fetchOptions.mode = 'cors';
fetchOptions.headers = headers;
return fetchOptions;
}
}