Migrated user/team/auth from redux to mobx

This commit is contained in:
Jori Lallo
2016-06-04 15:53:08 -07:00
parent 6a5303149d
commit e5d1612cbf
13 changed files with 129 additions and 194 deletions

View File

@@ -1,16 +1,14 @@
import React from 'react';
import { observe } from 'mobx'
import store from 'stores/UserStore';
import styles from './SlackAuthLink.scss';
export default class SlackAuthLink extends React.Component {
class SlackAuthLink extends React.Component {
static propTypes = {
scopes: React.PropTypes.arrayOf(React.PropTypes.string),
}
state = {
oauthState: Math.random().toString(36).substring(7),
}
static defaultProps = {
scopes: [
'identity.email',
@@ -20,10 +18,6 @@ export default class SlackAuthLink extends React.Component {
]
}
componentDidMount = () => {
localStorage.oauthState = this.state.oauthState;
}
slackUrl = () => {
const baseUrl = 'https://slack.com/oauth/authorize';
const params = {
@@ -32,7 +26,7 @@ export default class SlackAuthLink extends React.Component {
redirect_uri: __DEV__ ?
'http://localhost:3000/auth/slack/' :
'https://www.beautifulatlas.com/auth/slack/',
state: this.state.oauthState,
state: store.getOauthState(),
};
const urlParams = Object.keys(params).map(function(key) {
@@ -48,3 +42,5 @@ export default class SlackAuthLink extends React.Component {
)
}
}
export default SlackAuthLink;