37 lines
901 B
JavaScript
37 lines
901 B
JavaScript
import React, { Component } from 'react';
|
|
|
|
class Home extends Component {
|
|
state = {
|
|
apiStatus: 'loading',
|
|
};
|
|
|
|
componentDidMount() {
|
|
fetch('/api')
|
|
.then(response => response.json())
|
|
.then(result => {
|
|
console.log(result);
|
|
if (result.status === 1) {
|
|
this.setState({apiStatus: 'working'});
|
|
} else {
|
|
this.setState({apiStatus: 'NOT WORKING !'});
|
|
}
|
|
})
|
|
.catch(err => {
|
|
this.setState({apiStatus: `ERROR : ${err}`});
|
|
})
|
|
}
|
|
|
|
render () {
|
|
const {apiStatus} = this.state;
|
|
return (
|
|
<div>
|
|
<h3>CRM Integration</h3>
|
|
<hr/>
|
|
<h5>Integration API Status : {apiStatus}</h5>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default Home;
|