Created
October 26, 2016 07:38
-
-
Save isuvorov/162a62720d6ddf66c7e5cd023d8a75cb to your computer and use it in GitHub Desktop.
This file contains 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
export default class CoursePage extends Component { | |
componentDidMount() { | |
this.startLoad() | |
} | |
startLoad() { | |
const params = this.props.params | |
this.course = this.props.user.api.getCourse(params.courseId) | |
} | |
isLoaded() { | |
return Promise.all([ | |
this.props.user.loading(), | |
this.course, | |
]) | |
} | |
getLoadedData() { | |
return { | |
user: this.props.user, | |
course: this.course, | |
} | |
} | |
loadedRender() { | |
return <CoursePageView {...this.props} {...this.getLoadedData()} /> | |
} | |
render() { | |
if (!this.isLoaded()) return <Preloader /> | |
return this.loadedRender() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment