Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 6353 Rev 6354
Línea 5... Línea 5...
5
import { useDispatch } from 'react-redux'
5
import { useDispatch } from 'react-redux'
6
import { addNotification } from '../../../redux/notification/notification.actions'
6
import { addNotification } from '../../../redux/notification/notification.actions'
Línea 7... Línea 7...
7
 
7
 
8
import Spinner from '../../../shared/loading-spinner/Spinner'
8
import Spinner from '../../../shared/loading-spinner/Spinner'
9
import TagsInput from '../../../shared/tags-input/TagsInput'
-
 
Línea 10... Línea 9...
10
import FormErrorFeedback from '../../../shared/form-error-feedback/FormErrorFeedback'
9
import TagsInput from '../../../shared/tags-input/TagsInput'
11
 
10
 
12
const HobbiesModal = ({
11
const HobbiesModal = ({
13
  show = false,
12
  show = false,
14
  userIdEncrypted = '',
13
  userIdEncrypted = '',
15
  userHobbiesAndInterests = [],
14
  userHobbiesAndInterests = [],
16
  hobbiesAndInterestsOptions = [],
15
  hobbiesAndInterestsOptions = [],
17
  closeModal = () => {},
16
  closeModal = () => {},
18
  setUserHobbiesAndInterests = () => {},
17
  setUserHobbiesAndInterests = () => {},
19
}) => {
18
}) => {
20
  const { register, errors, handleSubmit, setValue } = useForm()
-
 
21
  const [modalLoading, setModalLoading] = useState(false)
19
  const { register, handleSubmit, setValue } = useForm()
Línea 22... Línea 20...
22
 
20
  const [modalLoading, setModalLoading] = useState(false)
23
  const dispatch = useDispatch()
21
  const dispatch = useDispatch()
24
 
22
 
Línea 25... Línea 23...
25
  const handleTagsChange = (tags) => {
23
  const handleTagsChange = (tags) => {
26
    setValue('hobbiesAndInterests', tags)
24
    setValue('hobbiesAndInterests', tags)
27
  }
25
  }
Línea 28... Línea -...
28
 
-
 
29
  const onSubmitHandler = async ({ hobbiesAndInterests }) => {
-
 
30
    setModalLoading(true)
26
 
31
    const formData = new FormData()
27
  const onSubmitHandler = async ({ hobbiesAndInterests }) => {
32
 
28
    setModalLoading(true)
Línea 33... Línea 29...
33
    console.log(hobbiesAndInterests)
29
    const formData = new FormData()
Línea 83... Línea 79...
83
            <TagsInput
79
            <TagsInput
84
              suggestions={hobbiesAndInterestsOptions}
80
              suggestions={hobbiesAndInterestsOptions}
85
              settedTags={userHobbiesAndInterests}
81
              settedTags={userHobbiesAndInterests}
86
              onChange={handleTagsChange}
82
              onChange={handleTagsChange}
87
            />
83
            />
88
            {errors.hobbiesAndInterests && (
-
 
89
              <FormErrorFeedback>
-
 
90
                {errors.hobbiesAndInterests.message}
-
 
91
              </FormErrorFeedback>
-
 
92
            )}
-
 
93
          </div>
84
          </div>
94
        </Modal.Body>
85
        </Modal.Body>
95
        <Modal.Footer>
86
        <Modal.Footer>
96
          <Button size="sm" type="submit">
87
          <Button size="sm" type="submit">
97
            Enviar
88
            Enviar