Pārlūkot izejas kodu

[FIX] login redirection

Gogs 7 gadi atpakaļ
vecāks
revīzija
70f1001b61
2 mainītis faili ar 10 papildinājumiem un 2 dzēšanām
  1. 10 1
      src/components/pages/Login.js
  2. 0 1
      src/reducers/containers.js

+ 10 - 1
src/components/pages/Login.js

@@ -91,6 +91,10 @@ class Login extends Component {
      * 
      */
     handleFormReset = () => {
+        if (!this.authForm) {
+            return
+        }
+
         this.authForm.reset()
     }
 
@@ -99,13 +103,17 @@ class Login extends Component {
      */
     render() {
         const { from } = this.props.location.state || { from: { pathname: '/' }}
-        const { isAuthenticated, notification, onHideNotification, classes } = this.props
+        const { isAuthenticated, isLoading, notification, onHideNotification, classes } = this.props
         const { hasError } = this.state
 
         if (isAuthenticated) {
             return <Redirect to={from} />
         }
 
+        if (isLoading) {
+            return <Typography align='center' variant='body1' color='primary'>Redireccionando...</Typography>
+        }
+
         return (
             <div className={classes.root}>
                 <Paper className={classes.paper} elevation={4}>
@@ -149,6 +157,7 @@ class Login extends Component {
 const mapStateToProps = (state, props) => {
     return {
         isAuthenticated: state.auth.isAuthenticated,
+        isLoading: state.spinner.isVisible,
         notification: state.notification
     }
 }

+ 0 - 1
src/reducers/containers.js

@@ -12,7 +12,6 @@ const initialState = {
  * @param {*} action 
  */
 const setContainers = (containers, action) => {
-    console.log(action)
     // single instance
     if (has(action.payload, 'container')) {
         return map(containers, c => {