Fixed persistent loading of user and team
This commit is contained in:
@@ -3,15 +3,12 @@ import { replace } from 'react-router-redux';
|
||||
import { client } from 'utils/ApiClient';
|
||||
import auth from 'utils/auth';
|
||||
|
||||
import { updateUser } from './UserActions';
|
||||
import { updateTeam } from './TeamActions';
|
||||
|
||||
export const SLACK_AUTH_PENDING = 'SLACK_AUTH_PENDING';
|
||||
export const SLACK_AUTH_SUCCESS = 'SLACK_AUTH_SUCCESS';
|
||||
export const SLACK_AUTH_FAILURE = 'SLACK_AUTH_FAILURE';
|
||||
|
||||
const slackAuthPending = makeActionCreator(SLACK_AUTH_PENDING);
|
||||
const slackAuthSuccess = makeActionCreator(SLACK_AUTH_SUCCESS, 'user');
|
||||
const slackAuthSuccess = makeActionCreator(SLACK_AUTH_SUCCESS, 'user', 'team');
|
||||
const slackAuthFailure = makeActionCreator(SLACK_AUTH_FAILURE, 'error');
|
||||
|
||||
export function slackAuthAsync(code) {
|
||||
@@ -23,12 +20,11 @@ export function slackAuthAsync(code) {
|
||||
})
|
||||
.then(data => {
|
||||
auth.setToken(data.data.accessToken);
|
||||
dispatch(updateUser(data.data.user));
|
||||
dispatch(updateTeam(data.data.team));
|
||||
dispatch(slackAuthSuccess(data.data.user, data.data.team));
|
||||
dispatch(replace('/dashboard'));
|
||||
})
|
||||
// .catch((err) => {
|
||||
// dispatch(push('/error'));
|
||||
// })
|
||||
.catch((err) => {
|
||||
dispatch(push('/error'));
|
||||
})
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user