|
@@ -1,8 +1,3 @@
|
|
|
-let data = [
|
|
|
- { id: 1, author: "Pete Hunt", text: "This is one comment" },
|
|
|
- { id: 2, author: "Jordan Walke", text: "This is *another* comment" }
|
|
|
-];
|
|
|
-
|
|
|
let Comment = React.createClass({
|
|
|
rawMarkup: function () {
|
|
|
let rawMarkup = marked(this.props.children.toString(), { sanitize: true });
|
|
@@ -51,6 +46,20 @@ let CommentBox = React.createClass({
|
|
|
getInitialState: function () {
|
|
|
return { data: [] };
|
|
|
},
|
|
|
+ componentDidMount: function () {
|
|
|
+ $.ajax({
|
|
|
+ url: this.props.url,
|
|
|
+ dataType: "json",
|
|
|
+ cache: false,
|
|
|
+ success: function (result) {
|
|
|
+ console.log('Received frop api: ', result);
|
|
|
+ this.setState({ data: result });
|
|
|
+ }.bind(this),
|
|
|
+ error: function (xhr, status, err) {
|
|
|
+ console.error(this.props.url, status, err.toString());
|
|
|
+ }.bind(this)
|
|
|
+ });
|
|
|
+ },
|
|
|
render: function () {
|
|
|
return (
|
|
|
<div className="commentBox">
|