Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 5427 Rev 5428
Línea 14... Línea 14...
14
  twitter,
14
  twitter,
15
  instagram,
15
  instagram,
16
  totalFollowers,
16
  totalFollowers,
17
  markFollower
17
  markFollower
18
}) => {
18
}) => {
19
  const [authLinks, setAuthLinks] = useState([])
19
  const [authLinks, setAuthLinks] = useState({})
20
  const [followers, setFollowers] = useState(totalFollowers)
20
  const [followers, setFollowers] = useState(totalFollowers)
Línea 21... Línea 21...
21
 
21
 
22
  const authClasses = {
22
  const authClasses = {
23
    link_unfollow: 'secondary',
23
    link_unfollow: 'secondary',
Línea 43... Línea 43...
43
  const fetchAuthLinks = async () => {
43
  const fetchAuthLinks = async () => {
44
    const response = await axios.get(`/company/view/${companyId}`)
44
    const response = await axios.get(`/company/view/${companyId}`)
45
    const { success, data } = response.data
45
    const { success, data } = response.data
Línea 46... Línea 46...
46
 
46
 
47
    if (success) {
47
    if (success) {
48
      const filterResponse = Object.entries(data).filter((key) => key[0].includes('link'))
-
 
49
      console.log(filterResponse)
-
 
50
 
48
      const filterResponse = Object.entries(data).filter((key) => key[0].includes('link') && key[1])
51
      const responseAuthLinks = filterResponse.map((key) => Object.fromEntries([key]))
-
 
52
 
-
 
Línea 53... Línea 49...
53
      console.log(responseAuthLinks)
49
      const responseAuthLinks = Object.fromEntries(filterResponse)
54
 
50
 
Línea 55... Línea 51...
55
      setAuthLinks(responseAuthLinks)
51
      setAuthLinks(responseAuthLinks)
Línea 99... Línea 95...
99
                <div className="members_count">
95
                <div className="members_count">
100
                    <b style={{ fontSize: '1rem' }} id="total-followers">{followers}</b>
96
                    <b style={{ fontSize: '1rem' }} id="total-followers">{followers}</b>
101
                    <p style={{ fontSize: '1rem' }} className="ellipsis">Seguidores</p>
97
                    <p style={{ fontSize: '1rem' }} className="ellipsis">Seguidores</p>
102
                </div>
98
                </div>
103
                <div className="row ">
99
                <div className="row ">
104
                    {authLinks.map(([key, value]) => (
100
                    {Object.entries(authLinks).map(([key, value]) => (
105
                        <button
101
                            <button
106
                            key={key}
102
                                key={key}
107
                            className={`btn btn-${authClasses[key]}`}
103
                                className={`btn btn-${authClasses[key]}`}
108
                            onClick={() => handleButtonAction(value)}
104
                                onClick={() => handleButtonAction(value)}
109
                        >
105
                            >
110
                            {authLabels[key]}
106
                                {authLabels[key]}
111
                        </button>
107
                            </button>
112
                    ))}
108
                    ))}
113
                </div>
109
                </div>
114
            </div>
110
            </div>
115
        </div>
111
        </div>
116
  )
112
  )