Proyectos de Subversion LeadersLinked - SPA

Rev

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

Rev 1854 Rev 1856
Línea 1... Línea 1...
1
import React, { useEffect, useState } from 'react'
1
import React, { useEffect, useMemo, useState } from 'react'
2
import { useDispatch, useSelector } from 'react-redux'
2
import { useDispatch, useSelector } from 'react-redux'
3
import { IconButton } from '@mui/material'
3
import { IconButton } from '@mui/material'
4
import { Edit } from '@mui/icons-material'
4
import { Edit } from '@mui/icons-material'
Línea 5... Línea 5...
5
 
5
 
6
import { axios } from '@app/utils'
6
import { axios, formatObjectToArray } from '@app/utils'
Línea 7... Línea 7...
7
import { addNotification } from '@app/redux/notification/notification.actions'
7
import { addNotification } from '@app/redux/notification/notification.actions'
8
 
8
 
9
import TagsList from '@app/components/UI/TagsList'
9
import TagsList from '@app/components/UI/TagsList'
Línea 17... Línea 17...
17
}) => {
17
}) => {
18
  const [skills, setSkills] = useState([])
18
  const [skills, setSkills] = useState([])
19
  const [showModal, setShowModal] = useState(false)
19
  const [showModal, setShowModal] = useState(false)
20
  const labels = useSelector(({ intl }) => intl.labels)
20
  const labels = useSelector(({ intl }) => intl.labels)
21
  const dispatch = useDispatch()
21
  const dispatch = useDispatch()
-
 
22
  const usersSkills = useMemo(() => formatObjectToArray(defaultSkills))
Línea 22... Línea 23...
22
 
23
 
Línea 23... Línea 24...
23
  const toggleModal = () => setShowModal(!showModal)
24
  const toggleModal = () => setShowModal(!showModal)
24
 
25
 
Línea 42... Línea 43...
42
        dispatch(addNotification({ style: 'danger', msg: error.message }))
43
        dispatch(addNotification({ style: 'danger', msg: error.message }))
43
      })
44
      })
44
  }
45
  }
Línea 45... Línea 46...
45
 
46
 
46
  useEffect(() => {
-
 
47
    const formattedSkills = Object.entries(defaultSkills).map(
-
 
48
      ([key, value]) => ({
-
 
49
        name: value,
-
 
50
        value: key
-
 
51
      })
-
 
52
    )
47
  useEffect(() => {
53
    setSkills(formattedSkills)
48
    setSkills(usersSkills)
Línea 54... Línea 49...
54
  }, [defaultSkills])
49
  }, [usersSkills])
55
 
50
 
56
  return (
51
  return (
57
    <>
52
    <>