1
0
mirror of https://github.com/mgerb/classic-wow-forums synced 2026-01-10 17:12:48 +00:00

client - add error message if user account does not have battletag

This commit is contained in:
2018-01-27 17:26:47 -06:00
parent da738c5535
commit b90860f251
6 changed files with 79 additions and 9 deletions

4
client/.gitignore vendored
View File

@@ -1,4 +1,6 @@
.vscode
node_modules
yarn-error*
dist
dist
prod_ssh_key
copy_build_prod.sh

View File

@@ -1,13 +1,22 @@
import React from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { parse } from 'query-string';
import { ContentContainer } from '../../components';
import { UserService } from '../../services';
interface Props extends RouteComponentProps<any> {}
interface State {}
interface State {
errorMessage?: string;
}
export class Oauth extends React.Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {};
}
componentDidMount() {
this.login(this.props.location.search);
}
@@ -17,14 +26,19 @@ export class Oauth extends React.Component<Props, State> {
const code = parse(queryString).code;
await UserService.authorize(code);
window.opener.location.reload();
// TODO: this doesn't work on mobile currently
window.close();
} catch (e) {
console.error(e);
this.setState({
errorMessage: 'Unable to log in. Your account may not be in the right region, or you may not have set a battletag.',
});
}
}
render() {
return <div />;
return (
<ContentContainer style={{ minHeight: '500px', padding: '50px', textAlign: 'center' }}>
<b>{this.state.errorMessage}</b>
</ContentContainer>
);
}
}

View File

@@ -198,9 +198,8 @@ export class UserAccount extends React.Component<Props, State> {
{noCharacters &&
<div>
<p>Unable to fetch your characters.
<a onClick={() => this.setState({ region: 'eu' }, () => this.getCharacters())}>EU account?</a>
</p>
<p>Unable to fetch your characters.</p>
<a onClick={() => this.setState({ region: 'eu' }, () => this.getCharacters())}>EU account?</a>
</div>
}