Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6510 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 6510 Rev 6511
Línea 1... Línea 1...
1
import React, { useRef, useState, useEffect } from 'react'
1
import React, { useRef, useState, useEffect } from 'react'
2
import { axios } from '../../../utils'
2
import { axios } from '../../../utils'
3
import { Link } from 'react-router-dom'
3
import { Link } from 'react-router-dom'
4
import { useForm } from 'react-hook-form'
4
import { useForm } from 'react-hook-form'
5
import { useSelector } from 'react-redux'
5
import { useDispatch, useSelector } from 'react-redux'
6
import { addNotification } from '../../../redux/notification/notification.actions'
6
import { addNotification } from '../../../redux/notification/notification.actions'
7
import styled from 'styled-components'
7
import styled from 'styled-components'
8
import Recaptcha from 'react-recaptcha'
8
import Recaptcha from 'react-recaptcha'
9
import CryptoJSAesJson from '../../../utils/crypto-js/cryptojs-aes-format'
9
import CryptoJSAesJson from '../../../utils/crypto-js/cryptojs-aes-format'
Línea 40... Línea 40...
40
  const { site_key, aes } = useSelector(({ auth }) => auth)
40
  const { site_key, aes } = useSelector(({ auth }) => auth)
41
  const [forgotSent, setForgotSent] = useState(false)
41
  const [forgotSent, setForgotSent] = useState(false)
42
  const [isLoading, setIsLoading] = useState(false)
42
  const [isLoading, setIsLoading] = useState(false)
43
  const [isVerified, setIsVerified] = useState(false)
43
  const [isVerified, setIsVerified] = useState(false)
Línea 44... Línea -...
44
 
-
 
45
  const reCaptchaInstance = useRef()
44
 
-
 
45
  const reCaptchaToken = useRef('')
-
 
46
  const reCaptchaInstance = useRef(null)
-
 
47
 
Línea 46... Línea 48...
46
  const reCaptchaToken = useRef('')
48
  const dispatch = useDispatch()
Línea 47... Línea 49...
47
 
49
 
48
  const { register, handleSubmit, setError, errors } = useForm({ mode: 'all' })
50
  const { register, handleSubmit, setError, errors } = useForm({ mode: 'all' })
Línea 87... Línea 89...
87
              })
89
              })
88
            })
90
            })
89
            return
91
            return
90
          }
92
          }
Línea 91... Línea 93...
91
 
93
 
92
          addNotification({ style: 'danger', msg: resError })
94
          dispatch(addNotification({ style: 'danger', msg: resError }))
-
 
95
        }
93
        }
96
 
94
        reCaptchaInstance.current.reset()
97
        reCaptchaInstance.current.reset()
95
        forgotPasswordExpiredCallbackHandler()
98
        forgotPasswordExpiredCallbackHandler()
96
        setForgotSent(true)
-
 
97
 
99
        setForgotSent(true)
98
        reCaptchaInstance.current.reset()
100
        reCaptchaInstance.current.reset()
99
        loginExpiredCallbackHandler()
101
        loginExpiredCallbackHandler()
-
 
102
      })
-
 
103
      .catch((err) => {
-
 
104
        dispatch(
-
 
105
          addNotification({
-
 
106
            style: 'danger',
-
 
107
            msg: 'Disculpe, ha ocurrido un error',
-
 
108
          })
-
 
109
        )
-
 
110
        console.log(`Error: ${err}`)
-
 
111
        throw new Error(err)
100
      })
112
      })
101
      .finally(() => setIsLoading(false))
113
      .finally(() => setIsLoading(false))
Línea 102... Línea 114...
102
  }
114
  }
103
 
115