Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1571 Rev 1572
Línea 26... Línea 26...
26
const InvitationsSent = (props) => {
26
const InvitationsSent = (props) => {
27
  // states
27
  // states
28
  const [sentInvitations, setSentInvitations] = useState([]);
28
  const [sentInvitations, setSentInvitations] = useState([]);
29
  const [loading, setLoading] = useState(false);
29
  const [loading, setLoading] = useState(false);
Línea 30... Línea -...
30
 
-
 
31
  // Redux
-
 
32
  const { addNotification } = props;
-
 
33
 
-
 
34
  // React hook form
-
 
35
  const { register, getValues } = useForm();
-
 
36
 
-
 
37
  let axiosThrottle = null;
-
 
38
 
-
 
39
  const handleCancel = (link) => {
-
 
40
    setLoading(true);
-
 
41
    axios
-
 
42
      .post(link)
-
 
43
      .then((response) => {
-
 
44
        const resData = response.data;
-
 
45
         (resData);
-
 
46
        if (resData.success) {
-
 
47
          const msg = resData.data;
-
 
48
          addNotification({
-
 
49
            style: "success",
-
 
50
            msg: msg,
-
 
51
          });
-
 
52
          fetchInvitations();
-
 
53
        } else {
-
 
54
          setLoading(false);
-
 
55
        }
-
 
56
      })
-
 
57
      .catch((error) => {
-
 
58
        setLoading(false);
-
 
59
      });
-
 
60
  };
-
 
61
 
30
 
62
  useEffect(() => {
31
  useEffect(() => {
63
    fetchInvitations();
32
    fetchInvitations();
Línea 64... Línea 33...
64
  }, []);
33
  }, []);
Línea 74... Línea 43...
74
        }
43
        }
75
      });
44
      });
76
    setLoading(false);
45
    setLoading(false);
77
  };
46
  };
Línea 78... Línea -...
78
 
-
 
79
  const handleSearch = () => {
-
 
80
    //  (getValues());
-
 
81
    clearTimeout(axiosThrottle);
-
 
82
    // setLoading(true);
-
 
83
    const searchValue = getValues("search");
-
 
84
    axiosThrottle = setTimeout(() => {
-
 
85
      fetchInvitations(searchValue);
-
 
86
    }, 500);
-
 
87
  };
-
 
88
 
47
 
89
  return (
48
  return (
90
    <section className="companies-info">
49
    <section className="companies-info">
91
      <div className="container">
50
      <div className="container">
92
        <SearchList
51
        <SearchList
93
          title="Invitaciones Enviadas"
52
          title="Invitaciones Enviadas"
94
          fetchCallback={handleSearch}
53
          fetchCallback={fetchInvitations}
Línea 95... Línea 54...
95
        />
54
        />
96
 
55
 
97
        <div className="companies-list">
56
        <div className="companies-list">
Línea 110... Línea 69...
110
                    image={image}
69
                    image={image}
111
                    name={name}
70
                    name={name}
112
                    link_delete={link_delete}
71
                    link_delete={link_delete}
113
                    link_view={link_view}
72
                    link_view={link_view}
114
                    key={id}
73
                    key={id}
115
                    fetchCallback={handleCancel}
74
                    fetchCallback={fetchInvitations}
116
                  />
75
                  />
117
                )
76
                )
118
              )
77
              )
119
            ) : (
78
            ) : (
120
              <p>No hay resultados</p>
79
              <p>No hay resultados</p>