UNPKG

cluedin-widget

Version:

This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.

60 lines (47 loc) 1.43 kB
import React, { Component } from 'react'; import { connect } from 'react-redux'; import iso from '../../iso'; import { fetchEntityForSalesForce } from '../../core/action/entity'; import CluedInApp from '../../core/components/cluedinapp.jsx'; const url = window.location.href; class App extends Component { constructor(props) { super(props); this.origin = iso.url.getParameterByName('origin', url); this.type = iso.url.getParameterByName('type', url); this.value = iso.url.getParameterByName('value', url); } componentWillMount() { this.props.dispatch(fetchEntityForSalesForce(this.type, this.origin, this.value)); } componentDidUpdate() { const { entity, } = this.props; //this.props.dispatch(goToLocation('entityWithTypeAndId', [this.type, entity])); } render() { const {token, entityId} = this.props; if (!this.origin || !this.type || !this.value) { return (<div>Something Wrong With the Url</div>); } if (!token) { return (<div>No token</div>); } return ( <CluedInApp paramToListen={this.id} type={this.type} standAlone={true} entityId={entityId} />); } } var select = (state) => { return { entityId: state.entity.entityFromSalesForce, isFetching: state.entity.isFetchingEntityFromSalesForce, token: state.core.token, }; }; export default connect(select)(App);