Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1972 Rev 1973
Línea 19... Línea 19...
19
  const dispatch = useDispatch()
19
  const dispatch = useDispatch()
Línea 20... Línea 20...
20
 
20
 
Línea 21... Línea 21...
21
  const { register, handleSubmit, getValues, setValue, errors } = useForm()
21
  const { register, handleSubmit, getValues, setValue, errors } = useForm()
22
 
-
 
23
  const onSubmit = handleSubmit((data) => {
-
 
24
    axios
-
 
25
      .post(url, {
-
 
26
        data
22
 
27
      })
23
  const onSubmit = handleSubmit((data) => {
28
      .then((response) => {
24
    axios.post(url, data).then((response) => {
29
        const { data, success } = response.data
25
      const { data, success } = response.data
30
 
26
 
31
        if (!success) {
27
      if (!success) {
32
          const errorMessage =
28
        const errorMessage =
33
            typeof data === 'string'
29
          typeof data === 'string'
34
              ? data
30
            ? data
35
              : 'Error interno. Por favor, inténtelo de nuevo más tarde.'
31
            : 'Error interno. Por favor, inténtelo de nuevo más tarde.'
36
 
32
 
37
          dispatch(addNotification({ style: 'danger', msg: errorMessage }))
33
        dispatch(addNotification({ style: 'danger', msg: errorMessage }))
38
          return
34
        return
39
        }
35
      }
40
 
36
 
41
        onComplete()
37
      onComplete()
42
        onClose()
38
      onClose()
Línea 43... Línea 39...
43
      })
39
    })
44
  })
40
  })
45
 
41