Proyectos de Subversion LeadersLinked - SPA

Rev

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

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