Merge pull request #662 from matrix-org/luke/rts-handle-errors
Throw errors on not 'ok' status codes from RTS, swap to `whatwg-fetch` for sending requests to RTS.
This commit is contained in:
commit
f8d7902d2e
2 changed files with 68 additions and 33 deletions
|
@ -111,23 +111,22 @@ module.exports = React.createClass({
|
|||
teamServerBusy: true,
|
||||
});
|
||||
// GET team configurations including domains, names and icons
|
||||
this._rtsClient.getTeamsConfig().then((args) => {
|
||||
// args = [$request, $body]
|
||||
this._rtsClient.getTeamsConfig().then((data) => {
|
||||
const teamsConfig = {
|
||||
teams: args[1],
|
||||
teams: data,
|
||||
supportEmail: this.props.teamServerConfig.supportEmail,
|
||||
};
|
||||
console.log('Setting teams config to ', teamsConfig);
|
||||
this.setState({
|
||||
teamsConfig: teamsConfig,
|
||||
teamServerBusy: false,
|
||||
});
|
||||
}, (err) => {
|
||||
console.error('Error retrieving config for teams', err);
|
||||
}).finally(() => {
|
||||
this.setState({
|
||||
teamServerBusy: false,
|
||||
});
|
||||
}).done();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -221,13 +220,12 @@ module.exports = React.createClass({
|
|||
self.props.referrer,
|
||||
response.user_id,
|
||||
self.state.formVals.email
|
||||
).then((args) => {
|
||||
const teamToken = args[1].team_token;
|
||||
).then((data) => {
|
||||
const teamToken = data.team_token;
|
||||
// Store for use /w welcome pages
|
||||
window.localStorage.setItem('mx_team_token', teamToken);
|
||||
|
||||
self._rtsClient.getTeam(teamToken).then((args) => {
|
||||
const team = args[1];
|
||||
self._rtsClient.getTeam(teamToken).then((team) => {
|
||||
console.log(
|
||||
`User successfully registered with team ${team.name}`
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue