Created
March 21, 2016 20:45
-
-
Save leofrozenyogurt/1f306e48bdec9179825e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AgencyInfo = React.createClass({ | |
componentWillMount(){ | |
this.getAgencyInfo(); | |
}, | |
getAgencyInfo(event){ | |
$.ajax({ | |
url: "agencies/"+this.props.id+".json", | |
dataType: 'json', | |
success: function(data) { | |
this.setState({rendered_categories: data}); | |
}.bind(this), | |
error: function(data) { | |
this.setState({rendered_categories: []}); | |
}.bind(this) | |
}); | |
console.log("happened"); | |
}, | |
render () { | |
var categories = (category) => <CategoryInfo title={category.title} currently={category.id} forward={category.id} /> | |
return ( | |
<div className="col-sm-6 agency-left-header"> | |
<img className="agency-logo img-responsive" src="http://placehold.it/300x300" /> | |
<h1>{this.props.name}</h1> | |
{this.state.rendered_categories.map(categories)} | |
</div> | |
) | |
} | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment