mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-11 01:22:48 +00:00
wip - oauth
This commit is contained in:
36
client/app/pages/oauth/oauth.tsx
Normal file
36
client/app/pages/oauth/oauth.tsx
Normal file
@@ -0,0 +1,36 @@
|
||||
import React from 'react';
|
||||
import { get } from 'lodash';
|
||||
import axios from 'axios';
|
||||
|
||||
interface Props {
|
||||
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
||||
}
|
||||
|
||||
export class Oauth extends React.Component<Props, State> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const code = get(this, 'props.location.query.code');
|
||||
|
||||
if (code) {
|
||||
// do stuff here
|
||||
this.fetchOauth(code as string);
|
||||
}
|
||||
}
|
||||
|
||||
private async fetchOauth(code: string) {
|
||||
const res = await axios.post('/api/oauth', { code });
|
||||
console.log(res);
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div></div>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user