x-essential-lib 0.10.23 → 0.10.25
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.d.ts +1 -1
- package/dist/index.js +1 -57
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -305,7 +305,7 @@ interface GlobalStates {
|
|
|
305
305
|
declare function useGlobalStates(globalStates: GlobalStates, base?: boolean): void;
|
|
306
306
|
//#endregion
|
|
307
307
|
//#region src/composables/microApp.d.ts
|
|
308
|
-
declare function useMicroApp(globalStates: GlobalStates,
|
|
308
|
+
declare function useMicroApp(globalStates: GlobalStates, customBack?: (m: RouteMeta) => void): void;
|
|
309
309
|
//#endregion
|
|
310
310
|
//#region src/composables/permission.d.ts
|
|
311
311
|
declare function usePermission(): {
|
package/dist/index.js
CHANGED
|
@@ -5,8 +5,6 @@ import { useI18n } from "vue-i18n";
|
|
|
5
5
|
import { useDisplay, useTheme } from "vuetify";
|
|
6
6
|
import axios from "axios";
|
|
7
7
|
import { useRoute, useRouter } from "vue-router";
|
|
8
|
-
import { getErrorMessage } from "x-error-lib";
|
|
9
|
-
import { createAxios as createAxios$1, messageError as messageError$1 } from "x-essential-lib";
|
|
10
8
|
|
|
11
9
|
//#region src/composables/color.ts
|
|
12
10
|
function useColor() {
|
|
@@ -742,67 +740,13 @@ function useGlobalStates(globalStates, base) {
|
|
|
742
740
|
});
|
|
743
741
|
}
|
|
744
742
|
|
|
745
|
-
//#endregion
|
|
746
|
-
//#region src/api/orgbase/instance.ts
|
|
747
|
-
const instance = createAxios$1({
|
|
748
|
-
baseUrl: "http://localhost/orgbase/",
|
|
749
|
-
onError: (error) => {
|
|
750
|
-
messageError$1(getErrorMessage(error));
|
|
751
|
-
}
|
|
752
|
-
});
|
|
753
|
-
if (window.API_URL) instance.defaults.baseURL = window.API_URL + "/orgbase/";
|
|
754
|
-
|
|
755
|
-
//#endregion
|
|
756
|
-
//#region src/api/orgbase/index.ts
|
|
757
|
-
function GetOrgName(request) {
|
|
758
|
-
return instance.post("getOrgName", request);
|
|
759
|
-
}
|
|
760
|
-
function PullPermission(request) {
|
|
761
|
-
return instance.post("pullPermission", request);
|
|
762
|
-
}
|
|
763
|
-
|
|
764
743
|
//#endregion
|
|
765
744
|
//#region src/composables/microApp.ts
|
|
766
|
-
function useMicroApp(globalStates,
|
|
745
|
+
function useMicroApp(globalStates, customBack) {
|
|
767
746
|
const route = useRoute();
|
|
768
747
|
const router = useRouter();
|
|
769
748
|
useGlobalStates(globalStates);
|
|
770
749
|
const { activeOrg, views } = globalStates;
|
|
771
|
-
async function syncOrg() {
|
|
772
|
-
const orgId = route.query.orgId;
|
|
773
|
-
if (!orgId) {
|
|
774
|
-
router.replace({ path: `/main/${Date.now()}` });
|
|
775
|
-
return false;
|
|
776
|
-
}
|
|
777
|
-
if (orgId === "public") {
|
|
778
|
-
eventBus.emit("updateActiveOrg", [orgId, ""]);
|
|
779
|
-
eventBus.emit("updatePermission", [{}, ""]);
|
|
780
|
-
return true;
|
|
781
|
-
}
|
|
782
|
-
try {
|
|
783
|
-
const { name } = await GetOrgName({ orgId });
|
|
784
|
-
const { permissions } = await PullPermission({
|
|
785
|
-
orgId,
|
|
786
|
-
checksum: ""
|
|
787
|
-
});
|
|
788
|
-
eventBus.emit("updateActiveOrg", [orgId, name]);
|
|
789
|
-
eventBus.emit("updatePermission", [toPermissionObjects(permissions), permissions.checksum ?? ""]);
|
|
790
|
-
return true;
|
|
791
|
-
} catch (e) {
|
|
792
|
-
if (e === "org not found" || e === "org member not found") router.replace({ path: `/main/${Date.now()}` });
|
|
793
|
-
return false;
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
async function fetch() {
|
|
797
|
-
if (!ignoreSyncOrg && !await syncOrg()) return;
|
|
798
|
-
await onRouteChange?.();
|
|
799
|
-
}
|
|
800
|
-
onBeforeMount(async () => {
|
|
801
|
-
await fetch();
|
|
802
|
-
});
|
|
803
|
-
watch(() => route.path, async () => {
|
|
804
|
-
await fetch();
|
|
805
|
-
});
|
|
806
750
|
async function handleBack() {
|
|
807
751
|
if (!isEmpty(views)) {
|
|
808
752
|
if (!hasView(views, "waitDlg")) popView(views);
|