Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1971 Rev 1979
Línea 20... Línea 20...
20
  const dispatch = useDispatch()
20
  const dispatch = useDispatch()
Línea 21... Línea 21...
21
 
21
 
Línea 22... Línea 22...
22
  const { register, handleSubmit, setValue, errors } = useForm()
22
  const { register, handleSubmit, setValue, errors } = useForm()
23
 
23
 
24
  const onSubmit = handleSubmit(({ description }) => {
24
  const onSubmit = handleSubmit(({ description }) => {
Línea -... Línea 25...
-
 
25
    const formData = new FormData()
-
 
26
    formData.append('description', description)
-
 
27
 
-
 
28
    axios
-
 
29
      .post(url, formData)
25
    axios.post(url, { description }).then((response) => {
30
      .then((response) => {
26
      const { data, success } = response.data
31
        const { data, success } = response.data
27
 
32
 
28
      if (!success) {
33
        if (!success) {
29
        const errorMessage =
34
          const errorMessage =
30
          typeof data === 'string'
35
            typeof data === 'string'
31
            ? data
36
              ? data
32
            : 'Error interno. Por favor, inténtelo de nuevo más tarde.'
37
              : 'Error interno. Por favor, inténtelo de nuevo más tarde.'
33
 
38
 
34
        dispatch(addNotification({ style: 'danger', msg: errorMessage }))
39
          dispatch(addNotification({ style: 'danger', msg: errorMessage }))
35
        return
40
          return
36
      }
41
        }
37
 
42
 
38
      onComplete(data)
43
        onComplete(data)
Línea 39... Línea 44...
39
      onClose()
44
        onClose()
40
    })
45
      })
41
  })
46
  })
Línea 63... Línea 68...
63
        config={CKEDITOR_OPTIONS}
68
        config={CKEDITOR_OPTIONS}
64
      />
69
      />
65
      {errors.description && (
70
      {errors.description && (
66
        <FormErrorFeedback>{labels.error_field_empty}</FormErrorFeedback>
71
        <FormErrorFeedback>{labels.error_field_empty}</FormErrorFeedback>
67
      )}
72
      )}
-
 
73
 
68
    </Modal>
74
    </Modal>
69
  )
75
  )
70
}
76
}
Línea 71... Línea 77...
71
 
77