Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1535 Rev 1537
Línea 4... Línea 4...
4
import { useForm } from "react-hook-form";
4
import { useForm } from "react-hook-form";
5
import styled from "styled-components";
5
import styled from "styled-components";
6
import {axios} from "../../../utils";
6
import {axios} from "../../../utils";
7
import { addNotification } from "../../../redux/notification/notification.actions";
7
import { addNotification } from "../../../redux/notification/notification.actions";
8
import Spinner from "../../../shared/loading-spinner/Spinner";
8
import Spinner from "../../../shared/loading-spinner/Spinner";
9
import AppliedJob from "./applied-job/AppliedJob";
-
 
10
import ProfileCard from "../../../profile/my-profiles/my-profiles/profile/Profile";
9
import ProfileCard from "../../../components/Profile";
11
import SearchList from "../../../components/SearchList";
10
import SearchList from "../../../components/SearchList";
Línea 12... Línea 11...
12
 
11
 
13
const StyledSpinnerContainer = styled.div`
12
const StyledSpinnerContainer = styled.div`
14
  position: absolute;
13
  position: absolute;
Línea 26... Línea 25...
26
const AppliedJobs = (props) => {
25
const AppliedJobs = (props) => {
27
  // states
26
  // states
28
  const [appliedJobs, setAppliedJobs] = useState([]);
27
  const [appliedJobs, setAppliedJobs] = useState([]);
29
  const [loading, setLoading] = useState(true);
28
  const [loading, setLoading] = useState(true);
Línea 30... Línea -...
30
 
-
 
31
  // redux destructuring
-
 
32
  const { addNotification } = props;
-
 
33
 
-
 
34
  // React hook form
-
 
35
  const { register, getValues } = useForm();
-
 
36
 
-
 
37
  let axiosThrottle = null;
-
 
38
 
29
 
39
  useEffect(() => {
30
  useEffect(() => {
40
    fetchAppliedJobs();
31
    fetchAppliedJobs();
41
    return () => {
32
    return () => {
42
      clearTimeout(axiosThrottle);
33
      clearTimeout(axiosThrottle);
43
    };
34
    };
Línea 44... Línea -...
44
  }, []);
-
 
45
 
-
 
46
  const handleCancelApply = (cancelLink) => {
-
 
47
    setLoading(true);
-
 
48
    axios
-
 
49
      .post(cancelLink)
-
 
50
      .then((response) => {
-
 
51
        const resData = response.data;
-
 
52
         (resData);
-
 
53
        if (resData.success) {
-
 
54
          const msg = resData.data;
-
 
55
          addNotification({
-
 
56
            style: "success",
-
 
57
            msg: msg,
-
 
58
          });
-
 
59
          fetchAppliedJobs();
-
 
60
        } else {
-
 
61
          const errorMsg =
-
 
62
            typeof resData.data === "string"
-
 
63
              ? resData.data
-
 
64
              : "Ha ocurrido un error, Por favor intente más tarde";
-
 
65
          addNotification({
-
 
66
            style: "danger",
-
 
67
            msg: errorMsg,
-
 
68
          });
-
 
69
          setLoading(false);
-
 
70
        }
-
 
71
      })
-
 
72
      .catch((error) => {
-
 
73
         (error);
-
 
74
        setLoading(false);
-
 
75
      });
-
 
76
  };
35
  }, []);
77
 
36
 
78
  const fetchAppliedJobs = async (searchParam='') => {
37
  const fetchAppliedJobs = async (searchParam='') => {
79
    setLoading(true);
38
    setLoading(true);
80
    await axios
39
    await axios
Línea 96... Línea 55...
96
      <div className="container">
55
      <div className="container">
97
        <SearchList
56
        <SearchList
98
          title="Que he aplicado"
57
          title="Que he aplicado"
99
          fetchCallback={fetchAppliedJobs}
58
          fetchCallback={fetchAppliedJobs}
100
        />
59
        />
101
        {/* <div className="company-title">
-
 
102
          <div className="section_admin_title_buttons">
-
 
103
            <div style={{ float: "left" }}>
-
 
104
              <h1 className="title">Que he aplicado</h1>
-
 
105
            </div>
-
 
106
          </div>
-
 
107
        </div>
-
 
108
 
-
 
109
        <div className="company-title">
-
 
110
          <div className="section_admin_title_buttons">
-
 
111
            <div className="form-group">
-
 
112
              <input
-
 
113
                type="text"
-
 
114
                name="search"
-
 
115
                id="search"
-
 
116
                className="form-control"
-
 
117
                placeholder="Buscar"
-
 
118
                ref={register}
-
 
119
                onChange={handleSearch}
-
 
120
              />
-
 
121
            </div>
-
 
122
          </div>
-
 
123
        </div> */}
-
 
124
        <div
60
        <div
125
          className="companies-list"
61
          className="companies-list"
126
          style={{
62
          style={{
127
            padding: "0 15px",
63
            padding: "0 15px",
128
          }}
64
          }}
Línea 147... Línea 83...
147
                    status={employment_type}
83
                    status={employment_type}
148
                    link_view={link_view}
84
                    link_view={link_view}
149
                    link_delete={link_remove}
85
                    link_delete={link_remove}
150
                    fetchCallback={fetchAppliedJobs}
86
                    fetchCallback={fetchAppliedJobs}
151
                  />
87
                  />
152
                  // <AppliedJob
-
 
153
                  //   title={title}
-
 
154
                  //   employment_type={employment_type}
-
 
155
                  //   last_date_of_application={last_date_of_application}
-
 
156
                  //   link_view={link_view}
-
 
157
                  //   link_remove={link_remove}
-
 
158
                  //   onCancelApply={handleCancelApply}
-
 
159
                  //   key={index}
-
 
160
                  // />
-
 
161
                )
88
                )
162
              )
89
              )
163
            ) : (
90
            ) : (
164
              <p>No hay resultados</p>
91
              <p>No hay resultados</p>
165
            )}
92
            )}