Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1593 Rev 1595
Línea 22... Línea 22...
22
 
22
 
Línea 23... Línea 23...
23
  let axiosThrottle = null;
23
  let axiosThrottle = null;
24
 
24
 
25
  useEffect(() => {
-
 
26
    fetchCompanies();
-
 
27
    return () => {
-
 
28
      clearTimeout(axiosThrottle);
25
  useEffect(() => {
Línea 29... Línea 26...
29
    };
26
    fetchCompanies();
30
  }, []);
27
  }, []);
31
 
28
 
Línea 41... Línea 38...
41
        }
38
        }
42
      });
39
      });
43
    setLoading(false);
40
    setLoading(false);
44
  };
41
  };
Línea 45... Línea -...
45
 
-
 
46
  const handleSearch = () => {
-
 
47
    //  (getValues());
-
 
48
    clearTimeout(axiosThrottle);
-
 
49
    // setLoading(true);
-
 
50
    const searchValue = getValues("search");
-
 
51
    axiosThrottle = setTimeout(() => {
-
 
52
      fetchCompanies(searchValue);
-
 
53
    }, 500);
-
 
54
  };
-
 
55
 
-
 
56
  const handleLeaveCompany = (link) => {
-
 
57
    setLoading(true);
-
 
58
    axios.post(link).then((response) => {
-
 
59
      const resData = response.data;
-
 
60
      if (resData.success) {
-
 
61
        addNotification({
-
 
62
          style: "success",
-
 
63
          msg: resData.data,
-
 
64
        });
-
 
65
        fetchCompanies();
-
 
66
      } else {
-
 
67
        setLoading(false);
-
 
68
        addNotification({
-
 
69
          style: "danger",
-
 
70
          msg: resData.data ?? "ha ocurrido un error",
-
 
71
        });
-
 
72
      }
-
 
73
    });
-
 
74
  };
-
 
75
 
42
 
76
  return (
43
  return (
77
    <section className="companies-info">
44
    <section className="companies-info">
78
      <div className="container">
45
      <div className="container">
79
        <SearchList
46
        <SearchList
Línea 92... Línea 59...
92
              companies.map(({image, link_leave, link_view, name}, id) => (
59
              companies.map(({image, link_leave, link_view, name}, id) => (
93
                <Profile
60
                <Profile
94
                  key={id}
61
                  key={id}
95
                  image={image}
62
                  image={image}
96
                  link_leave={link_leave}
63
                  link_leave={link_leave}
-
 
64
                  fetchCallback={fetchCompanies}
97
                  link_view={link_view}
65
                  link_view={link_view}
98
                  name={name}
66
                  name={name}
99
                />
67
                />
100
              ))
68
              ))
101
            ) : (
69
            ) : (