Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 7097 Rev 7098
Línea 77... Línea 77...
77
  const onConfirm = (url) => {
77
  const onConfirm = (url) => {
78
    setLoading(true)
78
    setLoading(true)
Línea 79... Línea 79...
79
 
79
 
80
    axios
80
    axios
81
      .post(url)
81
      .post(url)
-
 
82
      .then((response) => {
-
 
83
        const { success, data } = response.data
82
      .then(({ data }) => {
84
 
83
        if (!data.success) {
85
        if (!success) {
84
          const errorMessage =
-
 
85
            typeof data.data === 'string'
-
 
86
              ? data.data
86
          const errorMessage =
Línea 87... Línea 87...
87
              : labels.error_there_was_an_error
87
            typeof data === 'string' ? data : labels.error_there_was_an_error
88
 
88
 
89
          dispatch(addNotification({ style: 'danger', msg: errorMessage }))
89
          dispatch(addNotification({ style: 'danger', msg: errorMessage }))
Línea 90... Línea 90...
90
          return
90
          return
91
        }
91
        }
92
 
92
 
93
        if (fetchCallback) fetchCallback()
93
        if (fetchCallback) fetchCallback()
94
        dispatch(addNotification({ style: 'success', msg: data }))
94
        dispatch(addNotification({ style: 'success', msg: data }))
95
      })
95
      })
96
      .catch((error) => {
96
      .catch((err) => {
97
        dispatch(
97
        dispatch(
98
          addNotification({
98
          addNotification({
99
            style: 'error',
99
            style: 'error',
100
            msg: labels.error_there_was_an_error,
100
            msg: labels.error_there_was_an_error,
101
          })
101
          })
102
        )
102
        )
103
        throw new Error(error)
103
        throw new Error(err)
104
      })
104
      })
105
      .finally(() => {
105
      .finally(() => {
Línea 121... Línea 121...
121
 
121
 
122
          dispatch(addNotification({ style: 'danger', msg: errorMessage }))
122
          dispatch(addNotification({ style: 'danger', msg: errorMessage }))
123
          return
123
          return
Línea 124... Línea 124...
124
        }
124
        }
-
 
125
 
125
 
126
        if (fetchCallback) fetchCallback()
126
        fetchCallback()
127
        dispatch(addNotification({ style: 'success', msg: data }))
127
      })
128
      })
Línea 128... Línea 129...
128
      .finally(() => setLoading(false))
129
      .finally(() => setLoading(false))