Apply action/redux to the investigation container
Instead of
axios.get(getDatasetsByInvestigationId(this.state.sessionId, this.state.investigationId))
.then(res => {
this.setState({
datasets: res.data,
filtered: res.data,
fetching: false,
fecthed: true
});
})
.catch((error) => {
this.setState({
fetching: false,
fecthed: false
});
if (error.response) {
if (error.response.status === 403) {
this.props.doLogOut();
}
}
});
axios.get(getInvestigationById(this.state.sessionId, this.state.investigationId))
.then(res => {
if (res.data) {
if (res.data.length > 0) {
if (res.data[0].Investigation) {
var investigation = res.data[0].Investigation;
this.props.setBreadCrumbs([{ name: 'Investigations', link: '/investigations' }, { badge: investigation.name, name: investigation.summary, link: '/investigation/' + investigation.id + '/datasets' }]);
}
}
}
})
.catch((error) => {
});
we could also use the store and I think it will simplify the code