Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3736 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3736 Rev 3738
Línea 7... Línea 7...
7
 
7
 
8
export function OverviewForm({ uuid, description = '', onSubmit }) {
8
export function OverviewForm({ uuid, description = '', onSubmit }) {
Línea 9... Línea 9...
9
  const { showError, showSuccess } = useAlert();
9
  const { showError, showSuccess } = useAlert();
10
 
10
 
11
  const { execute } = useApi(saveGroupOverview, {
11
  const { execute } = useApi(saveGroupOverview, {
12
    onSuccess: (message) => {
12
    onSuccess: (data) => {
13
      showSuccess(message);
13
      showSuccess('Visión general actualizada correctamente');
14
      onSubmit();
14
      onSubmit(data);
15
    },
15
    },
16
    onError: (error) => {
16
    onError: (error) => {
17
      showError(error.message);
17
      showError(error.message);
Línea 18... Línea 18...
18
    }
18
    }
19
  });
19
  });
20
 
20
 
Línea 21... Línea -...
21
  const handleSubmit = (data) => {
-
 
22
    execute(uuid, data);
-
 
23
  };
-
 
24
 
-
 
25
  /* const onSubmit = (data) => {
-
 
26
    axios
-
 
27
      .post(typesUrl[type], formData)
-
 
28
      .then((response) => {
-
 
29
        const { data, success } = response.data;
-
 
30
        if (!success) {
-
 
31
          const errorMessage =
-
 
32
            typeof data === 'string'
-
 
33
              ? data
-
 
34
              : Object.entries(data).map(([key, value]) => `${key}: ${value}`)[0];
-
 
35
          throw new Error(errorMessage);
-
 
36
        }
-
 
37
 
-
 
38
        onComplete(data.description || data);
-
 
39
        closeModal();
-
 
40
      })
-
 
41
      .catch((err) => {
-
 
42
        dispatch(addNotification({ style: 'danger', msg: err.message }));
21
  const handleSubmit = (data) => {
43
      });
22
    execute(uuid, data);
44
  }; */
23
  };
45
 
24
 
46
  return (
25
  return (