Commit b8ce1662 authored by Axel Bocciarelli's avatar Axel Bocciarelli

Merge branch 'camera' into 'master'

Remove breadcrumbs dispatch from camera page

See merge request !441
parents faff1d3b 79955962
Pipeline #32608 passed with stages
in 7 minutes and 32 seconds
......@@ -2,59 +2,9 @@ import axios from 'axios';
import React, { Component } from 'react';
import Camera, { FACING_MODES } from 'react-html5-camera-photo';
import { connect } from 'react-redux';
import { setBreadCrumbs } from '../actions/breadcrumbs';
import { createEventFromBase64 } from '../api/icat-plus/logbook';
class CameraPage extends Component {
/* TODO: This should be refactored */
componentDidMount() {
const { investigationId } = this.props.match.params;
if (investigationId) {
const investigation = this.props.myInvestigations.find(
(investigation) => investigation.id === investigationId
);
if (investigation) {
// investigation was found in my Data
this.props.setBreadCrumbs([
{
name: 'My Data',
link: '/investigations',
},
{
name: 'Investigations',
link: '/investigations',
},
{
badge: investigation.name,
name: investigation.summary,
link: `/investigation/${investigation.id}/datasets`,
},
]);
} else {
// investion not found in my data, it can be among closed data
const closedInvestigation = this.props.investigations.find(
(investigation) => investigation.id === investigationId
);
if (closedInvestigation) {
// investigation was found in closed data
this.props.setBreadCrumbs([
{
name: 'Closed Data',
link: '/closed',
},
{
badge: closedInvestigation.name,
name: closedInvestigation.summary,
},
]);
}
}
}
}
onTakePhoto(dataUri) {
try {
axios({
......@@ -124,16 +74,7 @@ class CameraPage extends Component {
function mapStateToProps(state) {
return {
user: state.user,
investigations: state.investigations.data,
myInvestigations: state.myInvestigations.data,
releasedInvestigations: state.releasedInvestigations.data,
};
}
function mapDispatchToProps(dispatch) {
return {
setBreadCrumbs: (breadcrumbs) => dispatch(setBreadCrumbs(breadcrumbs)),
};
}
export default connect(mapStateToProps, mapDispatchToProps)(CameraPage);
export default connect(mapStateToProps)(CameraPage);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment