Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, () => {
axios.get(replace(interactionConfig.config.url, latlng))
.then(({ data }) => {
const { data: _data } = data;
const { interaction: currentInteractions } = this.state;
this.setState({
interaction: {
...currentInteractions,
[layer.id]: { data: _data[0] }
},
loading: false
});
})
.catch((err) => {
this.setState({ loading: false });
if (err && err.json && typeof err.json === 'function') {
err.json()
.then((er) => { console.error(er); });
const fetchs = datasets.map((dataset) => {
const selectedSubscription = dataset.subscriptions.find(
_subscription => _subscription.selected
);
if (selectedSubscription) {
const { query } = selectedSubscription;
return fetchQuery(token, replace(query, params));
}
return null;
}).filter(e => e !== null);
layersInteractionSelected
} = data;
const layer = layers.find(l => l.id === layersInteractionSelected) || layers[0];
if (!layer) return false;
const { interactionConfig } = layer;
if (
!isEmpty(latlng) &&
!!layers.length &&
!!interactionConfig.config &&
!!interactionConfig.config.url
) {
fetch(replace(interactionConfig.config.url, latlng))
.then((response) => {
if (response.ok) return response.json();
throw response;
})
.then(({ data }) => {
this.setState({
interaction: {
...this.state.interaction,
[layer.id]: {
...layer,
data: data[0]
}
},
loading: false
});
})