Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1456 Rev 1929
Línea 1... Línea 1...
1
import React, { useState } from 'react'
1
import React from 'react'
2
import { useDispatch, useSelector } from 'react-redux'
2
import { useDispatch, useSelector } from 'react-redux'
3
import { useForm } from 'react-hook-form'
3
import { useForm } from 'react-hook-form'
Línea 4... Línea 4...
4
 
4
 
5
import { axios } from 'utils/index'
5
import { axios } from 'utils/index'
6
import { addNotification } from '../../redux/notification/notification.actions'
6
import { addNotification } from '../../redux/notification/notification.actions'
Línea 7... Línea 7...
7
import useFetchHelper from '../../hooks/useFetchHelper'
7
import useFetchHelper from '../../hooks/useFetchHelper'
8
 
-
 
9
import Modal from 'components/UI/modal/Modal'
8
 
Línea 10... Línea 9...
10
import Spinner from 'components/UI/Spinner'
9
import Modal from 'components/UI/modal/Modal'
11
import FormErrorFeedback from 'components/UI/form/FormErrorFeedback'
10
import FormErrorFeedback from 'components/UI/form/FormErrorFeedback'
12
 
11
 
13
const AddCompanyModal = ({
12
const AddCompanyModal = ({
14
  show = false,
13
  show = false,
15
  onHide = () => null,
14
  onHide = () => null,
16
  fetchCompanies = () => []
15
  fetchCompanies = () => []
17
}) => {
-
 
18
  const { data: companySizes } = useFetchHelper('company-sizes')
16
}) => {
19
  const { data: industries } = useFetchHelper('industries')
17
  const { data: companySizes } = useFetchHelper('company-sizes')
Línea 20... Línea 18...
20
  const [loading, setLoading] = useState(false)
18
  const { data: industries } = useFetchHelper('industries')
Línea 21... Línea 19...
21
  const labels = useSelector(({ intl }) => intl.labels)
19
  const labels = useSelector(({ intl }) => intl.labels)
22
  const dispatch = useDispatch()
-
 
23
 
20
  const dispatch = useDispatch()
Línea 24... Línea 21...
24
  const { register, handleSubmit, errors } = useForm()
21
 
Línea 25... Línea 22...
25
 
22
  const { register, handleSubmit, errors } = useForm()
Línea 48... Línea 45...
48
        onHide()
45
        onHide()
49
      })
46
      })
50
      .catch((err) => {
47
      .catch((err) => {
51
        dispatch(addNotification({ style: 'danger', msg: err.message }))
48
        dispatch(addNotification({ style: 'danger', msg: err.message }))
52
      })
49
      })
53
      .finally(() => setLoading(false))
-
 
54
  })
50
  })
Línea 55... Línea 51...
55
 
51
 
56
  return (
52
  return (
57
    <Modal
53
    <Modal
Línea 116... Línea 112...
116
            {errors.company_size_id.message}
112
            {errors.company_size_id.message}
117
          </FormErrorFeedback>
113
          </FormErrorFeedback>
118
        )}
114
        )}
119
      </div>
115
      </div>
Línea 120... Línea -...
120
 
-
 
121
      {loading && <Spinner />}
116
 
122
    </Modal>
117
    </Modal>
123
  )
118
  )
Línea 124... Línea 119...
124
}
119
}