x-essential-lib 0.10.14 → 0.10.16
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.js +18 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -623,10 +623,7 @@ function onBeforeChange(toPath, fromPath, lastAppPath) {
|
|
|
623
623
|
if (fromPath === "/") fromPath = lastAppPath;
|
|
624
624
|
const toRouteMeta = matchRouteMeta(toPath);
|
|
625
625
|
const fromRouteMeta = matchRouteMeta(fromPath);
|
|
626
|
-
if (!toRouteMeta)
|
|
627
|
-
console.assert(false);
|
|
628
|
-
return;
|
|
629
|
-
}
|
|
626
|
+
if (!toRouteMeta) return;
|
|
630
627
|
console.info(`~~~~routeChange~~~~ ${fromPath} -> ${toPath}`);
|
|
631
628
|
if (!fromRouteMeta) return;
|
|
632
629
|
const sameApp = toRouteMeta.app === fromRouteMeta.app;
|
|
@@ -662,27 +659,27 @@ async function onBeforeEach(to, from, lastAppPath) {
|
|
|
662
659
|
const toRouteMeta = matchRouteMeta(to.path);
|
|
663
660
|
if (!toRouteMeta) return;
|
|
664
661
|
if (toRouteMeta.requireAuth && !hasAccessToken) return { path: `/passport/login` };
|
|
665
|
-
if (hasAccessToken && to.path.startsWith("/passport/")) return {
|
|
666
|
-
|
|
662
|
+
if (hasAccessToken && to.path.startsWith("/passport/")) return {
|
|
663
|
+
path: `/main/${Date.now()}`,
|
|
664
|
+
query: { orgId: "public" }
|
|
665
|
+
};
|
|
667
666
|
if (to.path.startsWith("/passport/")) onBeforeChange(to.path, from.path, lastAppPath);
|
|
668
|
-
else
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
await syncPermission(orgId);
|
|
672
|
-
onBeforeChange(to.path, from.path, lastAppPath);
|
|
673
|
-
} catch {
|
|
674
|
-
return {
|
|
667
|
+
else {
|
|
668
|
+
const orgId = to.query.orgId;
|
|
669
|
+
if (!orgId) return {
|
|
675
670
|
path: `/main/${Date.now()}`,
|
|
676
671
|
query: { orgId: "public" }
|
|
677
672
|
};
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
673
|
+
try {
|
|
674
|
+
await syncOrg(orgId);
|
|
675
|
+
await syncPermission(orgId);
|
|
676
|
+
onBeforeChange(to.path, from.path, lastAppPath);
|
|
677
|
+
} catch {
|
|
678
|
+
return {
|
|
679
|
+
path: `/main/${Date.now()}`,
|
|
680
|
+
query: { orgId: "public" }
|
|
681
|
+
};
|
|
682
|
+
}
|
|
686
683
|
}
|
|
687
684
|
}
|
|
688
685
|
|