react-ecosistema-unp 2.3.0 → 2.5.0-pre.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,70 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
},
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { getUserToken as c } from "../../../auth/services/User.js";
|
|
2
|
+
const t = () => `${window.location.protocol}//${window.location.host}/api-gateway`, r = () => ({
|
|
3
|
+
Authorization: `Bearer ${c()}`,
|
|
4
|
+
"BK-Service": "api-noti"
|
|
5
|
+
}), n = () => {
|
|
6
|
+
var e;
|
|
7
|
+
const a = localStorage.getItem("auth_state"), o = a ? JSON.parse(a) : null;
|
|
8
|
+
return ((e = o == null ? void 0 : o.user) == null ? void 0 : e.id_busuario) || "";
|
|
9
|
+
}, i = async (a) => {
|
|
10
|
+
const o = a.headers.get("content-type");
|
|
11
|
+
return o && o.indexOf("application/json") !== -1 ? await a.json() : null;
|
|
12
|
+
}, d = async () => {
|
|
9
13
|
try {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
const a = await fetch(`${t()}/usuarios/${n()}/notificaciones/count-unread?medio=1`, {
|
|
15
|
+
headers: r()
|
|
16
|
+
});
|
|
17
|
+
if (!a.ok) return 0;
|
|
18
|
+
const o = await i(a);
|
|
13
19
|
return o ? o.count : 0;
|
|
14
20
|
} catch {
|
|
15
21
|
return 0;
|
|
16
22
|
}
|
|
17
|
-
},
|
|
23
|
+
}, f = async (a, o = 1) => {
|
|
18
24
|
try {
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
return
|
|
25
|
+
let e = `${t()}/usuarios/${n()}/notificaciones?page=${o}&medio=1`;
|
|
26
|
+
a !== void 0 && (e += `&leida=${a}`);
|
|
27
|
+
const s = await fetch(e, { headers: r() });
|
|
28
|
+
return s.ok ? await i(s) || { count: 0, next: null, previous: null, results: [] } : { count: 0, next: null, previous: null, results: [] };
|
|
23
29
|
} catch {
|
|
24
30
|
return { count: 0, next: null, previous: null, results: [] };
|
|
25
31
|
}
|
|
26
|
-
},
|
|
32
|
+
}, h = async (a) => {
|
|
27
33
|
try {
|
|
28
|
-
const o = await fetch(`${
|
|
29
|
-
method: "POST"
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
const o = await fetch(`${t()}/usuarios/${n()}/notificaciones/${a}/marcar-leida/`, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
headers: r()
|
|
37
|
+
}), e = await i(o);
|
|
38
|
+
e && console.log(e.detail);
|
|
32
39
|
} catch {
|
|
33
40
|
console.error("Error al marcar como leída");
|
|
34
41
|
}
|
|
35
|
-
},
|
|
42
|
+
}, m = async (a) => {
|
|
36
43
|
try {
|
|
37
|
-
const o = await fetch(`${
|
|
38
|
-
method: "POST"
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
const o = await fetch(`${t()}/usuarios/${n()}/notificaciones/${a}/marcar-no-leida/`, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
headers: r()
|
|
47
|
+
}), e = await i(o);
|
|
48
|
+
e && console.log(e.detail);
|
|
41
49
|
} catch {
|
|
42
50
|
console.error("Error al marcar como no leída");
|
|
43
51
|
}
|
|
44
|
-
},
|
|
52
|
+
}, $ = async (a) => {
|
|
45
53
|
try {
|
|
46
|
-
const o = await fetch(`${
|
|
47
|
-
method: "POST"
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
const o = await fetch(`${t()}/usuarios/${n()}/notificaciones/${a}/eliminar/`, {
|
|
55
|
+
method: "POST",
|
|
56
|
+
headers: r()
|
|
57
|
+
}), e = await i(o);
|
|
58
|
+
e && console.log(e.detail);
|
|
50
59
|
} catch {
|
|
51
60
|
console.error("Error al eliminar la notificación");
|
|
52
61
|
}
|
|
53
|
-
},
|
|
62
|
+
}, w = async () => {
|
|
54
63
|
try {
|
|
55
|
-
const
|
|
56
|
-
method: "POST"
|
|
57
|
-
|
|
64
|
+
const a = await fetch(`${t()}/usuarios/${n()}/notificaciones/eliminar-leidas/`, {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: r()
|
|
67
|
+
}), o = await i(a);
|
|
58
68
|
o && console.log(o.detail);
|
|
59
69
|
} catch {
|
|
60
70
|
console.error("Error al eliminar las notificaciones leídas");
|
|
61
71
|
}
|
|
62
72
|
};
|
|
63
73
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
$ as eliminarNotificacion,
|
|
75
|
+
w as eliminarNotificacionesLeidas,
|
|
76
|
+
f as getNotificaciones,
|
|
77
|
+
d as getUnreadCount,
|
|
78
|
+
h as marcarLeida,
|
|
79
|
+
m as marcarNoLeida
|
|
70
80
|
};
|
|
@@ -8,7 +8,7 @@ const n = () => `${window.location.protocol}//${window.location.host}/api-gatewa
|
|
|
8
8
|
const a = await o.json();
|
|
9
9
|
return Array.isArray(a.documentos) ? a.documentos : [];
|
|
10
10
|
}, i = async (e, t = "v1") => {
|
|
11
|
-
t = "
|
|
11
|
+
t = "v2";
|
|
12
12
|
const r = `${n()}protecdoc/${t}/documentos/descargar/?id_documento=${encodeURIComponent(e)}`, o = await fetch(r, {
|
|
13
13
|
headers: { Authorization: `Bearer ${c()}` }
|
|
14
14
|
});
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { getUserToken as c } from "../../auth/services/User.js";
|
|
2
|
+
async function s(t, o) {
|
|
2
3
|
o(!0);
|
|
3
|
-
const e = `${window.location.protocol}//${window.location.host}/api-gateway/hser/`,
|
|
4
|
-
|
|
5
|
-
tipo: "nuip"
|
|
4
|
+
const e = `${window.location.protocol}//${window.location.host}/api-gateway/consulta-hser/`, a = {
|
|
5
|
+
cedula: t
|
|
6
6
|
};
|
|
7
7
|
try {
|
|
8
|
-
const
|
|
8
|
+
const r = await fetch(e, {
|
|
9
9
|
method: "POST",
|
|
10
10
|
headers: {
|
|
11
|
-
"Content-Type": "application/json"
|
|
11
|
+
"Content-Type": "application/json",
|
|
12
|
+
Authorization: `Bearer ${c()}`,
|
|
13
|
+
"BK-Service": "api-hei"
|
|
12
14
|
},
|
|
13
|
-
body: JSON.stringify(
|
|
14
|
-
}),
|
|
15
|
-
return
|
|
16
|
-
} catch (
|
|
17
|
-
return console.error("Error fetching data:",
|
|
15
|
+
body: JSON.stringify(a)
|
|
16
|
+
}), n = await r.json();
|
|
17
|
+
return r.ok ? (o(!1), n) : (o(!1), []);
|
|
18
|
+
} catch (r) {
|
|
19
|
+
return console.error("Error fetching data:", r), o(!1), [];
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
export {
|
|
21
|
-
|
|
23
|
+
s as fetchHistorico
|
|
22
24
|
};
|