Merge pull request #301 from matrix-org/dbkr/optional_config

Make the config optional
This commit is contained in:
Richard van der Hoff 2016-06-09 10:40:47 +01:00
commit 7700bb0ed9

View file

@ -41,7 +41,7 @@ module.exports = React.createClass({
displayName: 'MatrixChat', displayName: 'MatrixChat',
propTypes: { propTypes: {
config: React.PropTypes.object.isRequired, config: React.PropTypes.object,
ConferenceHandler: React.PropTypes.any, ConferenceHandler: React.PropTypes.any,
onNewScreen: React.PropTypes.func, onNewScreen: React.PropTypes.func,
registrationUrl: React.PropTypes.string, registrationUrl: React.PropTypes.string,
@ -84,7 +84,8 @@ module.exports = React.createClass({
getDefaultProps: function() { getDefaultProps: function() {
return { return {
startingQueryParams: {} startingQueryParams: {},
config: {},
}; };
}, },
@ -97,7 +98,7 @@ module.exports = React.createClass({
else if (window.localStorage && window.localStorage.getItem("mx_hs_url")) { else if (window.localStorage && window.localStorage.getItem("mx_hs_url")) {
return window.localStorage.getItem("mx_hs_url"); return window.localStorage.getItem("mx_hs_url");
} }
else if (this.props.config) { else {
return this.props.config.default_hs_url return this.props.config.default_hs_url
} }
return "https://matrix.org"; return "https://matrix.org";
@ -116,7 +117,7 @@ module.exports = React.createClass({
else if (window.localStorage && window.localStorage.getItem("mx_is_url")) { else if (window.localStorage && window.localStorage.getItem("mx_is_url")) {
return window.localStorage.getItem("mx_is_url"); return window.localStorage.getItem("mx_is_url");
} }
else if (this.props.config) { else {
return this.props.config.default_is_url return this.props.config.default_is_url
} }
return "https://matrix.org"; return "https://matrix.org";