@crystaltech/hsms-shared-ui 0.6.9-alpha-5 → 0.6.9-alpha-6

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.
package/dist/index.es.js CHANGED
@@ -28484,22 +28484,32 @@ const iM = ({ redirectPath: e = "/login" }) => (console.log(e), /* @__PURE__ */
28484
28484
  t(!0);
28485
28485
  try {
28486
28486
  const r = localStorage.getItem("refresh_token");
28487
- if (r && !(await fetch(
28488
- "https://api.crystaltechbd.com/hsms/org/api/auth/logout",
28489
- {
28490
- method: "POST",
28491
- headers: {
28492
- "Content-Type": "application/json"
28493
- },
28494
- body: JSON.stringify({
28495
- refresh_token: r
28496
- })
28487
+ if (r) {
28488
+ const i = await fetch(
28489
+ "https://api.crystaltechbd.com/hsms/org/api/auth/logout",
28490
+ {
28491
+ method: "POST",
28492
+ headers: {
28493
+ "Content-Type": "application/json"
28494
+ },
28495
+ credentials: "include",
28496
+ body: JSON.stringify({
28497
+ refresh_token: r
28498
+ })
28499
+ }
28500
+ );
28501
+ try {
28502
+ await i.text();
28503
+ } catch {
28497
28504
  }
28498
- )).ok)
28499
- throw new Error("Logout failed");
28505
+ }
28500
28506
  await Ip();
28501
28507
  } catch (r) {
28502
- throw console.log(r), r;
28508
+ console.log(r);
28509
+ try {
28510
+ await Ip();
28511
+ } catch {
28512
+ }
28503
28513
  } finally {
28504
28514
  t(!1);
28505
28515
  }
@@ -28916,22 +28926,28 @@ const iM = ({ redirectPath: e = "/login" }) => (console.log(e), /* @__PURE__ */
28916
28926
  ]
28917
28927
  }
28918
28928
  ),
28919
- t && /* @__PURE__ */ g.jsx(jo, { disableGutters: !0, sx: { py: 0, mt: 2 }, children: /* @__PURE__ */ g.jsx(
28929
+ /* @__PURE__ */ g.jsx(jo, { disableGutters: !0, sx: { py: 0, mt: 2 }, children: /* @__PURE__ */ g.jsx(
28920
28930
  Qo,
28921
28931
  {
28922
28932
  fullWidth: !0,
28923
28933
  variant: "contained",
28924
28934
  size: "large",
28925
28935
  onClick: () => {
28926
- l().then(async () => {
28927
- await Ip(), window.location.reload();
28928
- }).catch((d) => {
28929
- console.log(
28930
- "SKH logout failed, trying alternative logout",
28931
- d
28932
- ), t().then(async () => {
28933
- await Ip(), window.location.reload();
28934
- }).catch((p) => console.log(p));
28936
+ l().catch(() => {
28937
+ }).finally(async () => {
28938
+ if (t)
28939
+ try {
28940
+ await t();
28941
+ } catch {
28942
+ }
28943
+ try {
28944
+ await Ip();
28945
+ } catch {
28946
+ }
28947
+ try {
28948
+ window.location.reload();
28949
+ } catch {
28950
+ }
28935
28951
  });
28936
28952
  },
28937
28953
  startIcon: /* @__PURE__ */ g.jsx(Gw, {}),