Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 6509 | Rev 6513 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 6509 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 { useForm } from 'react-hook-form'
3
import { useForm } from 'react-hook-form'
4
import { useSelector } from 'react-redux'
4
import { useDispatch, useSelector } from 'react-redux'
5
import { addNotification } from '../../../redux/notification/notification.actions'
5
import { addNotification } from '../../../redux/notification/notification.actions'
6
import Recaptcha from 'react-recaptcha'
6
import Recaptcha from 'react-recaptcha'
7
import cryptoJsAesJson from '../../../utils/crypto-js/cryptojs-aes-format'
7
import cryptoJsAesJson from '../../../utils/crypto-js/cryptojs-aes-format'
Línea 8... Línea 8...
8
 
8
 
Línea 18... Línea 18...
18
  const [rememberChecked, setRememberChecked] = useState(false)
18
  const [rememberChecked, setRememberChecked] = useState(false)
19
  const [isLoading, setIsLoading] = useState(false)
19
  const [isLoading, setIsLoading] = useState(false)
20
  const [isVerified, setIsVerified] = useState(false)
20
  const [isVerified, setIsVerified] = useState(false)
Línea 21... Línea 21...
21
 
21
 
22
  const reCaptchaToken = useRef('')
22
  const reCaptchaToken = useRef('')
-
 
23
  const reCaptchaInstance = useRef(null)
-
 
24
 
Línea 23... Línea 25...
23
  const reCaptchaInstance = useRef()
25
  const dispatch = useDispatch()
24
 
26
 
Línea 25... Línea 27...
25
  const { register, handleSubmit, errors, setError, getValues, setValue } =
27
  const { register, handleSubmit, errors, setError, getValues, setValue } =
Línea 53... Línea 55...
53
                })
55
                })
54
              }
56
              }
55
            })
57
            })
56
            return
58
            return
57
          }
59
          }
58
          addNotification({ style: 'danger', msg: data })
60
          dispatch(addNotification({ style: 'danger', msg: data }))
59
          return
61
          return
60
        }
62
        }
Línea 61... Línea -...
61
 
-
 
62
        window.location.replace(data)
63
 
63
        event.target.reset()
64
        event.target.reset()
-
 
65
      })
-
 
66
      .catch((err) => {
-
 
67
        dispatch(
-
 
68
          addNotification({
-
 
69
            style: 'danger',
-
 
70
            msg: 'Disculpe, ha ocurrido un error',
-
 
71
          })
64
      })
72
        )
-
 
73
        console.log(`Error: ${err}`)
-
 
74
        throw new Error(err)
65
      .catch((err) => console.log(`Error: ${err}`))
75
      })
Línea 66... Línea 76...
66
      .finally(() => setIsLoading(false))
76
      .finally(() => setIsLoading(false))
67
 
77
 
68
    reCaptchaInstance.current.reset()
78
    reCaptchaInstance.current.reset()