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

thread page in progress

This commit is contained in:
2018-01-07 22:58:10 -06:00
parent 98f682fdce
commit 5ffa2753ed
51 changed files with 356 additions and 18 deletions

View File

@@ -0,0 +1,32 @@
import React from 'react';
import { RouteComponentProps } from 'react-router-dom';
import { parse } from 'query-string';
import axios from '../../axios/axios';
interface Props extends RouteComponentProps<any> {}
interface State {}
export class Oauth extends React.Component<Props, State> {
componentDidMount() {
this.login(this.props.location.search);
}
private async login(queryString: string) {
try {
const code = parse(queryString).code;
const res = await axios.post('/api/battlenet/authorize', { code });
const account = res.data.data;
localStorage.setItem('account', JSON.stringify(account));
window.opener.location.reload();
// TODO: this doesn't work on mobile currently
window.close();
} catch (e) {
console.error(e);
}
}
render() {
return <div />;
}
}