Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 1101 Rev 1102
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";
4
import { useForm } from "react-hook-form";
5
import {axios} from "../../../utils";
5
import { axios } from "../../../utils";
6
import { addNotification } from "../../../redux/notification/notification.actions";
6
import { addNotification } from "../../../redux/notification/notification.actions";
7
import Spinner from "../../../shared/loading-spinner/Spinner";
7
import Spinner from "../../../shared/loading-spinner/Spinner";
8
import RequestTemplate from './invitationTemplate/InvitationTemplate'
8
import RequestTemplate from './invitationTemplate/InvitationTemplate'
Línea 9... Línea 9...
9
 
9
 
Línea 25... Línea 25...
25
    return () => {
25
    return () => {
26
      clearTimeout(axiosThrottle);
26
      clearTimeout(axiosThrottle);
27
    };
27
    };
28
  }, []);
28
  }, []);
Línea 29... Línea 29...
29
 
29
 
30
  const fetchInvitationsReceived = async (searchParam='') => {
30
  const fetchInvitationsReceived = async (searchParam = '') => {
31
    setLoading(true);
31
    setLoading(true);
32
    await axios
32
    await axios
33
      .get(
33
      .get(
34
        "/group/invitations-received?search="+searchParam)
34
        "/group/invitations-received?search=" + searchParam)
35
      .then((response) => {
35
      .then((response) => {
36
        const resData = response.data;
36
        const resData = response.data;
37
         (resData);
37
        (resData);
38
        if (resData.success) {
38
        if (resData.success) {
39
          setInvitations(resData.data);
39
          setInvitations(resData.data);
40
        }
40
        }
41
      });
41
      });
42
    setLoading(false);
42
    setLoading(false);
Línea 43... Línea 43...
43
  };
43
  };
44
 
44
 
-
 
45
  const handleResponse = (link) => {
45
  const handleResponse = (link) => {
46
    setLoading(true);
46
    setLoading(true);
47
    axios.post(link)
47
    axios.post(link).then((response) => {
48
      .then((response) => {
48
      const resData = response.data;
49
        const resData = response.data;
49
      if (resData.success) {
50
        if (resData.success) {
50
        addNotification({
51
          addNotification({
51
          style: "success",
52
            style: "success",
52
          msg: resData.data,
53
            msg: resData.data,
53
        });
54
          });
54
        fetchInvitationsReceived();
55
          fetchInvitationsReceived();
55
      } else {
56
        } else {
56
        setLoading(false);
57
          setLoading(false);
57
        addNotification({
58
          addNotification({
58
          style: "danger",
59
            style: "danger",
59
          msg: resData.data ?? "ha ocurrido un error",
60
            msg: resData.data ?? "ha ocurrido un error",
60
        });
61
          });
61
      }
62
        }
Línea 62... Línea 63...
62
    });
63
      });
63
  };
64
  };
64
 
65