@tapni/auth 0.0.76 → 0.0.78

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.
@@ -8,7 +8,7 @@ import { Capacitor as Qt, registerPlugin as In, WebPlugin as Wo } from "@capacit
8
8
  import { Browser as hn } from "@capacitor/browser";
9
9
  import $o from "qr-code-styling";
10
10
  import { sanitizeUrl as Jo } from "@braintree/sanitize-url";
11
- const Xo = "0.0.76";
11
+ const Xo = "0.0.78";
12
12
  let Un;
13
13
  const Ft = {
14
14
  setApiRootFromOptions(n) {
@@ -41,7 +41,7 @@ const Ft = {
41
41
  } : {}
42
42
  }), n && n.token && !e) {
43
43
  const a = qr(n.token);
44
- if (a.exp - 30 < Math.floor(Date.now() / 1e3))
44
+ if (console.log("interceptor enter", a, a.exp - 30 < Math.floor(Date.now() / 1e3)), a.exp - 30 < Math.floor(Date.now() / 1e3))
45
45
  return ze.methods.refreshTokenAction(a).then(() => (i.headers = {
46
46
  ...i.headers,
47
47
  Authorization: `Bearer ${n.token}`
@@ -4393,9 +4393,9 @@ const ze = {
4393
4393
  methods: {
4394
4394
  errorHandler(n) {
4395
4395
  if (n && n.response && n.response.data && n.response.data.error) {
4396
- if (n.response.data.error === "ACCESS_DENIED" || n.response.data.error === "TOKEN_EXPIRED")
4396
+ if (n.response.data.error === "ACCESS_DENIED")
4397
4397
  return this.logout();
4398
- !n.response.data.error.includes("Network Error") && !n.response.data.error.includes("Cannot read properties") && this.errorSnack(n.response.data.error);
4398
+ !n.response.data.error.includes("Network Error") && !n.response.data.error.includes("TOKEN_EXPIRED") && !n.response.data.error.includes("Cannot read properties") && this.errorSnack(n.response.data.error);
4399
4399
  }
4400
4400
  return n;
4401
4401
  },
@@ -4469,7 +4469,7 @@ const ze = {
4469
4469
  });
4470
4470
  },
4471
4471
  async refreshTokenAction(n) {
4472
- if (!this.refreshToken || this.refreshing) {
4472
+ if (console.log("auth-refreshTokenAction", n), !this.refreshToken || this.refreshing) {
4473
4473
  console.log("return-refreshTokenAction", this.refreshToken, this.refreshing);
4474
4474
  return;
4475
4475
  }
@@ -4483,7 +4483,7 @@ const ze = {
4483
4483
  );
4484
4484
  if (e && e.response && e.response.data.error === "ACCESS_DENIED")
4485
4485
  return this.logout(!1), location.reload();
4486
- t && t.data ? this.setToken(t.data.token) : console.error("Invalid response setToken"), this.refreshing = !1;
4486
+ t && t.data ? (this.setToken(t.data.token), z.$emit("ssoEvent", { name: "setStorage", data: this.$storage })) : console.error("Invalid response setToken"), this.refreshing = !1;
4487
4487
  },
4488
4488
  async login(n) {
4489
4489
  const [e, t] = await Z(Ne.login(n, this.$storage));