Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 3434 Rev 3450
Línea 23... Línea 23...
23
    control,
23
    control,
24
    formState: { isSubmitting },
24
    formState: { isSubmitting },
25
    handleSubmit
25
    handleSubmit
26
  } = useForm();
26
  } = useForm();
Línea 27... Línea 27...
27
 
27
 
28
  const onSubmit = handleSubmit(async ({ cover }) => {
28
  const onSubmit = handleSubmit(async (cover) => {
29
    try {
-
 
30
      const formData = new FormData();
-
 
31
      formData.append('cover', cover);
-
 
32
 
29
    try {
33
      const response = await axios.post(url, formData);
-
 
34
 
30
      const response = await axios.post(url, cover);
Línea 35... Línea 31...
35
      const { data, success } = response.data;
31
      const { data, success } = response.data;
Línea 36... Línea 32...
36
 
32
 
37
      if (!success) throw new Error('Error al actualizar el portada');
33
      if (!success) throw new Error('Error al actualizar el portada');
38
 
34
 
39
      onChange(data);
-
 
40
      onClose();
35
      onChange(data);
41
    } catch (error) {
36
      onClose();
42
      console.log(error);
37
    } catch (error) {
Línea 43... Línea 38...
43
      dispatch(addNotification({ style: 'danger', msg: error.message }));
38
      dispatch(addNotification({ style: 'danger', msg: error.message }));