Commit 4da7d06e by zhanghaozhe

bug

parent 93d8d984
...@@ -42,7 +42,7 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { ...@@ -42,7 +42,7 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
} }
// Tools like Cloud9 rely on this. // Tools like Cloud9 rely on this.
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000; const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 80;
const HOST = process.env.HOST || '0.0.0.0'; const HOST = process.env.HOST || '0.0.0.0';
if (process.env.HOST) { if (process.env.HOST) {
......
...@@ -54,7 +54,7 @@ class App extends Component { ...@@ -54,7 +54,7 @@ class App extends Component {
jsCookie.set('role', role, expires) jsCookie.set('role', role, expires)
jsCookie.set('uid', uid, expires) jsCookie.set('uid', uid, expires)
jsCookie.set('token', token, expires) jsCookie.set('token', token, expires)
this.props.receiveUser(user) this.props.setCurrentUser(user)
} }
} else { } else {
Toast.info(data.msg) Toast.info(data.msg)
......
...@@ -8,8 +8,8 @@ import AccountLogin from './accountLogin' ...@@ -8,8 +8,8 @@ import AccountLogin from './accountLogin'
import ForgotPassword from './forgotPassword' import ForgotPassword from './forgotPassword'
import SetPassword from './setPassword' import SetPassword from './setPassword'
import BindingTel from './bindingTel' import BindingTel from './bindingTel'
import {connect} from "react-redux"; import { connect } from "react-redux";
import {compose} from "redux"; import { compose } from "redux";
import account from './account.png' import account from './account.png'
import qq from './qq.png' import qq from './qq.png'
...@@ -48,6 +48,25 @@ class Passport extends Component { ...@@ -48,6 +48,25 @@ class Passport extends Component {
} }
} }
componentDidMount() {
this.routeWhenUserLoggedIn()
}
componentDidUpdate() {
this.routeWhenUserLoggedIn()
}
routeWhenUserLoggedIn = () => {
let {history} = this.props
if (Object.values(this.props.user.data).filter(item => !!item).length) {
history.action === 'POP' && history.go(-1)
}
}
render() { render() {
let {match, location} = this.props let {match, location} = this.props
return ( return (
......
...@@ -17,13 +17,17 @@ function Loading(props) { ...@@ -17,13 +17,17 @@ function Loading(props) {
return return
} }
if (!isLoading) {
return
}
if (!user.isFetching) { if (!user.isFetching) {
if (user.hasError) { if (user.hasError) {
history.push('/passport', {from: location}) history.replace('/passport', {from: location})
setLoadingState(false) setLoadingState(false)
} else { } else {
if (Object.values(user.data).every(item => !!item).length !== 0) { if (Object.values(user.data).every(item => !!item).length !== 0) {
history.push(location.pathname) history.replace(location.pathname)
setLoadingState(false) setLoadingState(false)
} }
} }
...@@ -32,7 +36,9 @@ function Loading(props) { ...@@ -32,7 +36,9 @@ function Loading(props) {
return ( return (
<div className={'loading-route'}> <div className={'loading-route'}>
<LoadingComponent isLoading={isLoading}/> <LoadingComponent isLoading={isLoading}>
<div></div>
</LoadingComponent>
</div> </div>
); );
} }
......
...@@ -12,7 +12,7 @@ module.exports = function (app) { ...@@ -12,7 +12,7 @@ module.exports = function (app) {
pathRewrite: { pathRewrite: {
[`^${config[item]['development']}`]: '' [`^${config[item]['development']}`]: ''
}, },
cookieDomainRewrite: 'localhost', // cookieDomainRewrite: 'localhost',
...config[item]['proxy'] ...config[item]['proxy']
} }
)) ))
......
...@@ -33,7 +33,8 @@ const storeUser = (res, dispatch) => { ...@@ -33,7 +33,8 @@ const storeUser = (res, dispatch) => {
} else { } else {
payload = { payload = {
hasError: true, hasError: true,
msg: data.msg msg: data.msg,
data: {}
} }
} }
dispatch(setCurrentUser(payload)) dispatch(setCurrentUser(payload))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment