Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 4009 Rev 4011
Línea -... Línea 1...
-
 
1
/* eslint-disable react/prop-types */
1
import React, { useEffect, useState } from "react";
2
import React from "react";
2
import { useDispatch } from "react-redux";
3
import { useDispatch } from "react-redux";
-
 
4
import useFetchHelper from "../../../hooks/useFetchHelper";
3
import { addNotification } from "../../../redux/notification/notification.actions";
5
import { addNotification } from "../../../redux/notification/notification.actions";
4
import { axios } from "../../../utils";
6
import { axios } from "../../../utils";
Línea 5... Línea 7...
5
 
7
 
Línea 6... Línea 8...
6
const PeopleYouMayKnow = () => {
8
const PeopleYouMayKnow = ({ url = `/helpers/people-you-may-know` }) => {
7
 
9
 
Línea 8... Línea 10...
8
  const [peopleYouMayKnow, setPeopleYouMayKnow] = useState([]);
10
  const { data: peopleYouMayKnow } = useFetchHelper(url)
9
  const dispatch = useDispatch()
11
  const dispatch = useDispatch()
10
 
12
 
Línea 23... Línea 25...
23
        dispatch(addNotification({ style: 'success', msg: data.data }))
25
        dispatch(addNotification({ style: 'success', msg: data.data }))
24
        return
26
        return
25
      })
27
      })
26
  }
28
  }
Línea 27... Línea -...
27
 
-
 
28
  useEffect(() => {
-
 
29
    const getSuggestion = async (url = `/helpers/people-you-may-know`) => {
-
 
30
      try {
-
 
31
        const { data } = await axios.get(url)
-
 
32
        const resData = [...data.data].slice(0, 3);
-
 
33
        if (data.success) return setPeopleYouMayKnow(resData);
-
 
34
      } catch (error) {
-
 
35
        console.log(error);
-
 
36
      }
-
 
37
    }
-
 
38
 
-
 
39
    getSuggestion()
-
 
40
  }, []);
-
 
41
 
29
 
42
  return (
30
  return (
43
    <div className='peopleYouMayKnow'>
31
    <div className='peopleYouMayKnow'>
44
      <div className="sd-title d-flex align-items-center justify-content-between">
32
      <div className="sd-title d-flex align-items-center justify-content-between">
45
        <h3>Conecta con:</h3>
33
        <h3>Conecta con:</h3>