react-ecosistema-unp 1.6.0-pre.9 → 1.6.2

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,20 +1,22 @@
1
1
  import { jsx as u } from "react/jsx-runtime";
2
- import { createContext as a, useState as e } from "react";
3
- const c = a(void 0), i = ({ children: t }) => {
4
- const [o, r] = e(
5
- localStorage.getItem("access_token")
6
- ), [n, s] = e(
7
- localStorage.getItem("user_token")
2
+ import { createContext as c, useState as t } from "react";
3
+ const a = c(void 0), x = ({ children: e }) => {
4
+ const [o, n] = t(
5
+ // localStorage.getItem("access_token")
6
+ ""
7
+ ), [r, s] = t(
8
+ // localStorage.getItem("user_token")
9
+ ""
8
10
  );
9
- return /* @__PURE__ */ u(
10
- c.Provider,
11
+ return console.log("authContext"), /* @__PURE__ */ u(
12
+ a.Provider,
11
13
  {
12
- value: { authToken: o, setAuthToken: r, userToken: n, setUserToken: s },
13
- children: t
14
+ value: { authToken: o, setAuthToken: n, userToken: r, setUserToken: s },
15
+ children: e
14
16
  }
15
17
  );
16
18
  };
17
19
  export {
18
- c as AuthContext,
19
- i as AuthProvider
20
+ a as AuthContext,
21
+ x as AuthProvider
20
22
  };
@@ -1,25 +1,24 @@
1
- import { useAuthId as c } from "./AuthHook.js";
2
- import { FinSesionService as u } from "../services/FinSesionService.js";
3
- import { y as l } from "../../index-BUe3EJDH.js";
4
- import { useState as m, useEffect as f } from "react";
5
- import { j as d } from "../../index-CuHybtft.js";
6
- const g = () => {
7
- const { setAuthToken: t, setUserToken: r } = c(), [e, i] = m(null), n = `${window.location.protocol}//${window.location.host}/`;
8
- return f(() => {
1
+ import { FinSesionService as r } from "../services/FinSesionService.js";
2
+ import { y as a } from "../../index-BUe3EJDH.js";
3
+ import { useState as c, useEffect as m } from "react";
4
+ import { j as l } from "../../index-CuHybtft.js";
5
+ const p = () => {
6
+ const [e, t] = c(null), n = `${window.location.protocol}//${window.location.host}/`;
7
+ return m(() => {
9
8
  const o = sessionStorage.getItem("user_token");
10
9
  if (o) {
11
- const s = d(o);
12
- i(s);
10
+ const s = l(o);
11
+ t(s);
13
12
  }
14
13
  }, []), { FinSesion: () => {
15
- l.promise(
14
+ a.promise(
16
15
  new Promise(async (o, s) => {
17
16
  try {
18
- await u((e == null ? void 0 : e.datos_basicos.username) || "", n), sessionStorage.removeItem("user_token"), t(null), r(null), setTimeout(() => {
17
+ await r((e == null ? void 0 : e.datos_basicos.username) || "", n), sessionStorage.removeItem("user_token"), setTimeout(() => {
19
18
  o(!0), window.location.href = n;
20
19
  }, 1e3);
21
- } catch (a) {
22
- s(a);
20
+ } catch (i) {
21
+ s(i);
23
22
  }
24
23
  }),
25
24
  {
@@ -31,5 +30,5 @@ const g = () => {
31
30
  } };
32
31
  };
33
32
  export {
34
- g as useFinalizarSesion
33
+ p as useFinalizarSesion
35
34
  };
@@ -3,4 +3,5 @@ declare global {
3
3
  originalFetch: typeof fetch;
4
4
  }
5
5
  }
6
- export {};
6
+ declare const _default: {};
7
+ export default _default;