Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 3892 Rev 5173
Línea 1... Línea 1...
1
/* eslint-disable react/prop-types */
1
/* eslint-disable react/prop-types */
2
import React from "react";
-
 
3
import { useEffect, useState } from "react";
2
import React, { useEffect, useState } from 'react'
4
import { axios } from "../../../utils";
3
import { axios } from '../../../utils'
Línea 5... Línea 4...
5
 
4
 
6
const SuggestedGroupsHelper = ({ suggestedClassname }) => {
-
 
7
 
5
const SuggestedGroupsHelper = ({ suggestedClassname }) => {
8
  const [suggestedGroups, setSuggestedGroups] = useState([]);
6
  const [suggestedGroups, setSuggestedGroups] = useState([])
Línea 9... Línea 7...
9
  const [lookMore, setLookMore] = useState(false);
7
  const [lookMore, setLookMore] = useState(false)
10
 
8
 
Línea 11... Línea 9...
11
  useEffect(() => {
9
  useEffect(() => {
12
    const url = '/helpers/groups-suggestion'
10
    const url = '/helpers/groups-suggestion'
13
 
11
 
14
    axios.get(url)
12
    axios.get(url)
15
      .then(({ data }) =>
13
      .then(({ data }) =>
16
        data.success &&
14
        data.success &&
Línea 17... Línea 15...
17
        setSuggestedGroups(data.data.sort((a, b) => parseInt(a.priority) - parseInt(b.priority)).reverse())
15
        setSuggestedGroups(data.data.sort((a, b) => parseInt(a.priority) - parseInt(b.priority)).reverse())
18
      )
16
      )
19
  }, []);
17
  }, [])
20
 
18
 
21
  const getData = () => {
19
  const getData = () => {
22
    let infoFollows = [...suggestedGroups]
20
    let infoFollows = [...suggestedGroups]
23
    if (!lookMore) {
21
    if (!lookMore) {
24
      infoFollows = infoFollows.slice(0, 3);
22
      infoFollows = infoFollows.slice(0, 3)
25
    }
23
    }
Línea 63... Línea 61...
63
          )
61
          )
64
          : <div className="view-more">Sin sugerencias</div>
62
          : <div className="view-more">Sin sugerencias</div>
65
        }
63
        }
66
      </div>
64
      </div>
67
    </div>
65
    </div>
68
  );
66
  )
69
};
67
}
Línea 70... Línea 68...
70
 
68