1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Add .isRequired to App proptypes

This commit is contained in:
Brett Sun 2016-01-12 15:05:00 +01:00
parent 1dca764166
commit 315e5f0108
4 changed files with 22 additions and 14 deletions

View File

@ -18,11 +18,12 @@ import { mergeOptions } from '../utils/general_utils';
let AscribeApp = React.createClass({ let AscribeApp = React.createClass({
propTypes: { propTypes: {
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
children: React.PropTypes.oneOfType([ children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.element), React.PropTypes.arrayOf(React.PropTypes.element),
React.PropTypes.element React.PropTypes.element
]), ])
routes: React.PropTypes.arrayOf(React.PropTypes.object)
}, },
getInitialState() { getInitialState() {

View File

@ -21,12 +21,13 @@ import { getCookie } from '../../../../utils/fetch_api_utils';
let PRApp = React.createClass({ let PRApp = React.createClass({
propTypes: { propTypes: {
history: React.PropTypes.object.isRequired,
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
children: React.PropTypes.oneOfType([ children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.element), React.PropTypes.arrayOf(React.PropTypes.element),
React.PropTypes.element React.PropTypes.element
]), ])
history: React.PropTypes.object,
routes: React.PropTypes.arrayOf(React.PropTypes.object)
}, },
getInitialState() { getInitialState() {
@ -54,7 +55,8 @@ let PRApp = React.createClass({
}, },
render() { render() {
const { children, currentUser, history, routes, whitelabel } = this.props; const { children, history, routes } = this.props;
const { currentUser, whitelabel } = this.state;
const subdomain = getSubdomain(); const subdomain = getSubdomain();
// Add the current user and whitelabel settings to all child routes // Add the current user and whitelabel settings to all child routes

View File

@ -20,12 +20,13 @@ import { getSubdomain, mergeOptions } from '../../../../utils/general_utils';
let PrizeApp = React.createClass({ let PrizeApp = React.createClass({
propTypes: { propTypes: {
history: React.PropTypes.object.isRequired,
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
children: React.PropTypes.oneOfType([ children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.element), React.PropTypes.arrayOf(React.PropTypes.element),
React.PropTypes.element React.PropTypes.element
]), ])
history: React.PropTypes.object,
routes: React.PropTypes.arrayOf(React.PropTypes.object)
}, },
getInitialState() { getInitialState() {
@ -53,7 +54,8 @@ let PrizeApp = React.createClass({
}, },
render() { render() {
const { children, currentUser, history, routes, whitelabel } = this.props; const { children, history, routes } = this.props;
const { currentUser, whitelabel } = this.state;
const subdomain = getSubdomain(); const subdomain = getSubdomain();
// The second element of routes is always the active component object, where we can // The second element of routes is always the active component object, where we can

View File

@ -19,12 +19,13 @@ import { getSubdomain, mergeOptions } from '../../../utils/general_utils';
let WalletApp = React.createClass({ let WalletApp = React.createClass({
propTypes: { propTypes: {
history: React.PropTypes.object.isRequired,
routes: React.PropTypes.arrayOf(React.PropTypes.object).isRequired,
children: React.PropTypes.oneOfType([ children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.element), React.PropTypes.arrayOf(React.PropTypes.element),
React.PropTypes.element React.PropTypes.element
]), ])
history: React.PropTypes.object,
routes: React.PropTypes.arrayOf(React.PropTypes.object)
}, },
getInitialState() { getInitialState() {
@ -38,6 +39,7 @@ let WalletApp = React.createClass({
UserStore.listen(this.onChange); UserStore.listen(this.onChange);
WhitelabelStore.listen(this.onChange); WhitelabelStore.listen(this.onChange);
console.log('fetch');
UserActions.fetchCurrentUser(); UserActions.fetchCurrentUser();
WhitelabelActions.fetchWhitelabel(); WhitelabelActions.fetchWhitelabel();
}, },
@ -52,7 +54,8 @@ let WalletApp = React.createClass({
}, },
render() { render() {
const { children, currentUser, history, routes, whitelabel } = this.props; const { children, history, routes } = this.props;
const { currentUser, whitelabel } = this.state;
const subdomain = getSubdomain(); const subdomain = getSubdomain();
// The second element of routes is always the active component object, where we can // The second element of routes is always the active component object, where we can