Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 4241 Rev 5087
Línea -... Línea 1...
-
 
1
/* eslint-disable camelcase */
1
/* eslint-disable react/prop-types */
2
/* eslint-disable react/prop-types */
2
import React, { useEffect, useState } from "react";
3
import React, { useEffect, useState } from 'react'
3
import { axios } from "../../../utils";
4
import { axios } from '../../../utils'
4
import Spinner from "../../../shared/loading-spinner/Spinner";
5
import Spinner from '../../../shared/loading-spinner/Spinner'
5
import Profile from "../../../components/Profile";
6
import Profile from '../../../components/Profile'
6
import SearchList from "../../../components/SearchList";
7
import SearchList from '../../../components/SearchList'
Línea 7... Línea 8...
7
 
8
 
-
 
9
const InvitationsReceived = () => {
-
 
10
  const [companies, setCompanies] = useState([])
Línea 8... Línea -...
8
const InvitationsReceived = () => {
-
 
9
 
-
 
10
  const [companies, setCompanies] = useState([]);
-
 
11
  const [loading, setLoading] = useState(true);
11
  const [loading, setLoading] = useState(true)
Línea 12... Línea 12...
12
 
12
 
13
  let axiosThrottle = null;
13
  const axiosThrottle = null
14
 
14
 
15
  useEffect(() => {
15
  useEffect(() => {
16
    fetchCompanies();
16
    fetchCompanies()
17
    return () => {
17
    return () => {
Línea 18... Línea 18...
18
      clearTimeout(axiosThrottle);
18
      clearTimeout(axiosThrottle)
19
    };
19
    }
20
  }, []);
20
  }, [])
21
 
21
 
22
  const fetchCompanies = (searchParam = '') => {
22
  const fetchCompanies = (searchParam = '') => {
23
    setLoading(true);
23
    setLoading(true)
24
    axios
24
    axios
25
      .get("/company/invitations-received?search=" + searchParam)
25
      .get('/company/invitations-received?search=' + searchParam)
26
      .then(({ data: response }) => {
26
      .then(({ data: response }) => {
27
        if (response.success) {
27
        if (response.success) {
28
          setCompanies(response.data)
28
          setCompanies(response.data)
29
        }
29
        }
Línea 30... Línea 30...
30
      })
30
      })
31
      .finally(() => setLoading(false))
31
      .finally(() => setLoading(false))
32
    setLoading(false);
32
    setLoading(false)
33
  };
33
  }
Línea 41... Línea 41...
41
        />
41
        />
42
        <div className="companies-list position-relative">
42
        <div className="companies-list position-relative">
43
          {loading && <Spinner />}
43
          {loading && <Spinner />}
44
          {
44
          {
45
            companies.length
45
            companies.length
46
              ?
-
 
47
              companies.map(({ image, name, link_view, link_reject, link_accept }, id) => (
46
              ? companies.map(({ image, name, link_view, link_reject, link_accept }, id) => (
48
                <Profile
47
                <Profile
49
                  key={id}
48
                  key={id}
50
                  image={image}
49
                  image={image}
51
                  name={name}
50
                  name={name}
52
                  link_view={link_view}
51
                  link_view={link_view}
Línea 54... Línea 53...
54
                  link_accept={link_accept}
53
                  link_accept={link_accept}
55
                  fetchCallback={fetchCompanies}
54
                  fetchCallback={fetchCompanies}
56
                  btnAcceptTitle='Ver Empresa'
55
                  btnAcceptTitle='Ver Empresa'
57
                />
56
                />
58
              ))
57
              ))
59
              :
-
 
60
              <div style={{ margin: "auto", textAlign: "center" }}>
58
              : <div style={{ margin: 'auto', textAlign: 'center' }}>
61
                {LABELS.not_found}
59
                {LABELS.not_found}
62
              </div>
60
              </div>
63
          }
61
          }
64
        </div>
62
        </div>
65
      </div>
63
      </div>
66
    </section >
64
    </section>
67
  );
65
  )
68
};
66
}
Línea 69... Línea -...
69
 
-
 
70
export default InvitationsReceived;
67
 
-
 
68
export default InvitationsReceived