mirror of
https://github.com/wassname/talk.git
synced 2026-08-18 12:30:39 +08:00
Separate store
This commit is contained in:
@@ -8,16 +8,14 @@ import './graphql';
|
||||
import {addExternalConfig} from 'coral-embed-stream/src/actions/config';
|
||||
|
||||
import reducers from './reducers';
|
||||
import localStore, {injectReducers} from 'coral-framework/services/store';
|
||||
import store, {injectReducers} from 'coral-framework/services/store';
|
||||
import AppRouter from './AppRouter';
|
||||
import {pym} from 'coral-framework';
|
||||
|
||||
injectReducers(reducers);
|
||||
|
||||
const store = (window.opener && window.opener.coralStore) ? window.opener.coralStore : localStore;
|
||||
|
||||
// Don't run this in the popup.
|
||||
if (store === localStore) {
|
||||
if (!window.opener) {
|
||||
store.dispatch(checkLogin());
|
||||
|
||||
pym.sendMessage('getConfig');
|
||||
|
||||
@@ -192,7 +192,7 @@ export const fetchSignUpFacebook = () => (dispatch) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const facebookCallback = (err, data) => (dispatch, getState) => {
|
||||
export const facebookCallback = (err, data) => (dispatch) => {
|
||||
if (err) {
|
||||
dispatch(signInFacebookFailure(err));
|
||||
return;
|
||||
@@ -201,10 +201,6 @@ export const facebookCallback = (err, data) => (dispatch, getState) => {
|
||||
dispatch(handleAuthToken(data.token));
|
||||
dispatch(signInFacebookSuccess(data.user));
|
||||
dispatch(hideSignInDialog());
|
||||
const {user: {canEditName, status}} = getState().auth.toJS();
|
||||
if (canEditName && status !== 'BANNED') {
|
||||
dispatch(showCreateUsernameDialog());
|
||||
}
|
||||
} catch (err) {
|
||||
dispatch(signInFacebookFailure(err));
|
||||
return;
|
||||
@@ -306,6 +302,11 @@ export const checkLogin = () => (dispatch) => {
|
||||
}
|
||||
|
||||
dispatch(checkLoginSuccess(result.user));
|
||||
|
||||
// Display create username dialog if necessary.
|
||||
if (result.user.canEditName && result.user.status !== 'BANNED') {
|
||||
dispatch(showCreateUsernameDialog());
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
|
||||
@@ -100,7 +100,7 @@ class ChangeUsernameContainer extends React.Component {
|
||||
return (
|
||||
<div>
|
||||
<CreateUsernameDialog
|
||||
open={auth.showCreateUsernameDialog && auth.user.canEditName}
|
||||
open={auth.showCreateUsernameDialog}
|
||||
handleClose={this.handleClose}
|
||||
loggedIn={loggedIn}
|
||||
handleSubmitUsername={this.handleSubmitUsername}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
const express = require('express');
|
||||
const bowser = require('bowser');
|
||||
const {passport, HandleGenerateCredentials, HandleLogout} = require('../../../services/passport');
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
Reference in New Issue
Block a user