Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 2810 Rev 3063
Línea 1... Línea 1...
1
import React from "react";
1
import React from "react";
2
import { useEffect, useState } from "react";
2
import { useEffect, useState } from "react";
3
import { connect } from "react-redux";
3
import { connect } from "react-redux";
4
import { useForm } from "react-hook-form";
-
 
5
import styled from "styled-components";
4
import styled from "styled-components";
6
import { axios } from "../../../utils";
5
import { axios } from "../../../utils";
7
import { addNotification } from "../../../redux/notification/notification.actions";
6
import { addNotification } from "../../../redux/notification/notification.actions";
8
import Spinner from "../../../shared/loading-spinner/Spinner";
7
import Spinner from "../../../shared/loading-spinner/Spinner";
9
import SavedJob from "./saved-job/SavedJob";
-
 
10
import SearchList from "../../../components/SearchList";
8
import SearchList from "../../../components/SearchList";
11
import Card from "../../../components/Profile";
9
import Card from "../../../components/Profile";
Línea 12... Línea 10...
12
 
10
 
13
const StyledSpinnerContainer = styled.div`
11
const StyledSpinnerContainer = styled.div`
Línea 21... Línea 19...
21
  justify-content: center;
19
  justify-content: center;
22
  align-items: center;
20
  align-items: center;
23
  z-index: 300;
21
  z-index: 300;
24
`;
22
`;
Línea 25... Línea 23...
25
 
23
 
26
const SavedJobs = (props) => {
24
const SavedJobs = () => {
27
  // states
25
  // states
28
  const [savedJobs, setSavedJobs] = useState([]);
26
  const [savedJobs, setSavedJobs] = useState([]);
Línea 29... Línea -...
29
  const [loading, setLoading] = useState(true);
-
 
30
 
-
 
31
  // redux destructuring
-
 
32
  const { addNotification } = props;
-
 
33
 
-
 
34
  // React hook form
-
 
35
  const { register, getValues } = useForm();
27
  const [loading, setLoading] = useState(true);
Línea 36... Línea 28...
36
 
28
 
37
  let axiosThrottle = null;
29
  let axiosThrottle = null;
38
 
30
 
Línea 70... Línea 62...
70
      });
62
      });
71
  };
63
  };
Línea 72... Línea 64...
72
 
64
 
73
  const fetchSavedJobs = async (searchParam = '') => {
65
  const fetchSavedJobs = async (searchParam = '') => {
74
    setLoading(true);
-
 
75
    await axios
-
 
76
      .get(
66
    setLoading(true);
77
        "/job/saved-jobs?search=" + searchParam)
67
    await axios.get("/job/saved-jobs?search=" + searchParam)
78
      .then((response) => {
68
      .then((response) => {
79
        const resData = response.data;
69
        const resData = response.data;
80
        if (resData.success) {
70
        if (resData.success) {
81
          console.log(resData.data)
71
          console.log(resData.data)
Línea 90... Línea 80...
90
      <div className="container">
80
      <div className="container">
91
        <SearchList
81
        <SearchList
92
          title="Empleos guardados"
82
          title="Empleos guardados"
93
          fetchCallback={fetchSavedJobs}
83
          fetchCallback={fetchSavedJobs}
94
        />
84
        />
95
        <div
-
 
96
          className="companies-list"
85
        <div className="companies-list" style={{ padding: "0 15px", }}>
97
          id="profiles-container"
-
 
98
          style={{
-
 
99
            padding: "0 15px",
86
          {savedJobs.length > 0
100
          }}
87
            ?
101
        >
-
 
102
          {savedJobs.length > 0 ? (
-
 
103
            savedJobs.map(
88
            savedJobs.map(
104
              (
89
              ({
105
                {
-
 
106
                  title,
-
 
107
                  employment_type,
90
                employment_type,
108
                  last_date_of_application,
-
 
109
                  image,
91
                id,
110
                  link_view,
92
                image,
111
                  link_remove,
93
                link_remove,
112
                },
94
                link_view,
113
                index
95
                title,
114
              ) => (
96
              }) =>
115
                <Card
97
                <Card
116
                  key={index}
98
                  key={id}
117
                  image={image}
99
                  image={image}
118
                  name={title}
100
                  name={title}
119
                  status={employment_type}
101
                  status={employment_type}
120
                  link_view={link_view}
102
                  link_view={link_view}
121
                  link_delete={link_remove}
103
                  link_delete={link_remove}
122
                  fetchCallback={fetchSavedJobs}
104
                  fetchCallback={fetchSavedJobs}
123
                  btnAcceptTitle='Ver Empleo'
105
                  btnAcceptTitle='Ver Empleo'
124
                  btnCancelTitle='Eliminar'
106
                  btnCancelTitle='Eliminar'
125
                />
107
                />
126
                // <SavedJob
-
 
127
                //   title={title}
-
 
128
                //   employment_type={employment_type}
-
 
129
                //   last_date_of_application={last_date_of_application}
-
 
130
                //   link_view={link_view}
-
 
131
                //   link_remove={link_remove}
-
 
132
                //   onCancelApply={handleCancelApply}
-
 
133
                //   key={index}
-
 
134
                // />
-
 
135
              )
-
 
136
            )
108
            )
137
          ) : (
-
 
138
            <p>No hay resultados</p>
109
            : <p>No hay resultados</p>
139
          )}
110
          }
140
          {/* <!--product-feed-tab end--> */}
-
 
141
        </div>
111
        </div>
142
      </div>
112
      </div>
143
      {loading && (
113
      {loading && (
144
        <StyledSpinnerContainer>
114
        <StyledSpinnerContainer>
145
          <Spinner />
115
          <Spinner />