Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6727 Rev 6861
Línea 2... Línea 2...
2
import { axios } from '../../utils'
2
import { axios } from '../../utils'
3
import { useForm } from 'react-hook-form'
3
import { useForm } from 'react-hook-form'
4
import { Button, Modal } from 'react-bootstrap'
4
import { Button, Modal } from 'react-bootstrap'
5
import { addNotification } from '../../redux/notification/notification.actions'
5
import { addNotification } from '../../redux/notification/notification.actions'
6
import { connect, useSelector } from 'react-redux'
6
import { connect, useSelector } from 'react-redux'
-
 
7
 
7
import FormErrorFeedback from '../UI/FormErrorFeedback'
8
import FormErrorFeedback from '../UI/FormErrorFeedback'
Línea 8... Línea 9...
8
 
9
 
9
const AddProfileModal = ({
10
const AddProfileModal = ({
10
  show = '',
11
  show = '',
Línea 17... Línea 18...
17
 
18
 
18
  const onSubmitHandler = async (data) => {
19
  const onSubmitHandler = async (data) => {
19
    const formData = new FormData()
20
    const formData = new FormData()
Línea -... Línea 21...
-
 
21
    Object.entries(data).map(([key, value]) => formData.append(key, value))
20
    Object.entries(data).map(([key, value]) => formData.append(key, value))
22
 
-
 
23
    axios
-
 
24
      .post('/profile/my-profiles/add', formData)
21
 
25
      .then(({ data: response }) => {
-
 
26
        const { data, success } = response
-
 
27
        if (success) {
-
 
28
          return
-
 
29
        }
22
    await axios.post('/profile/my-profiles/add', formData).then(({ data }) => {
30
 
23
      if (data.success) {
31
        getProfiles()
24
        return addNotification({ style: 'success', msg: data.data })
32
        addNotification({ style: 'success', msg: data })
-
 
33
        onHide()
25
      }
34
      })
26
    })
35
      .catch((err) => {
-
 
36
        console.log(err)
27
    onHide()
37
        throw new Error(err)
Línea 28... Línea 38...
28
    getProfiles()
38
      })
29
  }
39
  }
30
 
40