dsi-icl/optimise

View on GitHub
packages/optimise-ui/src/components/patientProfile/patientDispatch.jsx

Summary

Maintainability
A
0 mins
Test Coverage
import React, { Component } from 'react';
import { Redirect } from 'react-router-dom';
import { connect } from 'react-redux';

@connect(state => ({
    currentPatient: state.patientProfile.currentPatient
}))
class PatientDispatch extends Component {
    render() {
        if (this.props.currentPatient === undefined || this.props.currentPatient === null)
            return <Redirect to='/searchPatient' />;
        else
            return <Redirect to={`/patientProfile/${this.props.currentPatient}`} />;
    }
}

export {PatientDispatch};