move value by prop in providers to consistent interface

This commit is contained in:
John Mitchell
2019-04-18 10:52:35 -04:00
parent ae72d8dce5
commit e1333f5e00
4 changed files with 62 additions and 41 deletions

View File

@@ -15,7 +15,8 @@ class Provider extends Component {
custom_virtualenvs: null,
version: null,
custom_logo: null,
custom_login_info: null
custom_login_info: null,
...props.value
}
};
@@ -66,14 +67,12 @@ class Provider extends Component {
}
render () {
const {
value: stateValue
} = this.state;
const { value } = this.state;
const { value: propsValue, children } = this.props;
const { children } = this.props;
return (
<ConfigContext.Provider value={propsValue || stateValue}>
<ConfigContext.Provider value={value}>
{children}
</ConfigContext.Provider>
);

View File

@@ -26,7 +26,8 @@ class Provider extends Component {
this.handle404();
}
return (err.response.status === 401 || err.response.status === 404);
}
},
...props.value
}
};
}
@@ -58,14 +59,12 @@ class Provider extends Component {
}
render () {
const {
value: stateValue
} = this.state;
const { value } = this.state;
const { value: propsValue, children } = this.props;
const { children } = this.props;
return (
<NetworkContext.Provider value={propsValue || stateValue}>
<NetworkContext.Provider value={value}>
{children}
</NetworkContext.Provider>
);

View File

@@ -17,7 +17,7 @@ export class RootDialogProvider extends Component {
const { value } = this.state;
this.setState({ value: { ...value, title: null, bodyText: null, variant: null } });
},
...props.value,
...props.value
}
};
}