fix(acl): change route.uiSchemaUid to useAdminSchemaUid
This commit is contained in:
parent
6a589543f9
commit
daa48302df
@ -1,7 +1,7 @@
|
|||||||
import { Spin } from 'antd';
|
import { Spin } from 'antd';
|
||||||
import React, { createContext, useContext } from 'react';
|
import React, { createContext, useContext } from 'react';
|
||||||
import { useRequest, useAPIClient } from '../../api-client';
|
import { useRequest } from '../../api-client';
|
||||||
import { useRoute } from '../../route-switch';
|
import { useSystemSettings } from '../../system-settings';
|
||||||
|
|
||||||
const MenuItemsContext = createContext(null);
|
const MenuItemsContext = createContext(null);
|
||||||
|
|
||||||
@ -27,10 +27,15 @@ export const useMenuItems = () => {
|
|||||||
return useContext(MenuItemsContext);
|
return useContext(MenuItemsContext);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const useAdminSchemaUid = () => {
|
||||||
|
const ctx = useSystemSettings();
|
||||||
|
return ctx?.data?.data?.options?.adminSchemaUid;
|
||||||
|
};
|
||||||
|
|
||||||
export const MenuItemsProvider = (props) => {
|
export const MenuItemsProvider = (props) => {
|
||||||
const route = useRoute();
|
const adminSchemaUid = useAdminSchemaUid();
|
||||||
const options = {
|
const options = {
|
||||||
url: `uiSchemas:getProperties/${route.uiSchemaUid}`,
|
url: `uiSchemas:getProperties/${adminSchemaUid}`,
|
||||||
};
|
};
|
||||||
const service = useRequest(options);
|
const service = useRequest(options);
|
||||||
if (service.loading) {
|
if (service.loading) {
|
||||||
|
@ -16,7 +16,6 @@ import {
|
|||||||
useACLRoleContext,
|
useACLRoleContext,
|
||||||
useDocumentTitle,
|
useDocumentTitle,
|
||||||
useRequest,
|
useRequest,
|
||||||
useRoute,
|
|
||||||
useSystemSettings,
|
useSystemSettings,
|
||||||
} from '../../../';
|
} from '../../../';
|
||||||
import { useCollectionManager } from '../../../collection-manager';
|
import { useCollectionManager } from '../../../collection-manager';
|
||||||
@ -67,7 +66,6 @@ const MenuEditor = (props) => {
|
|||||||
const defaultSelectedUid = params.name;
|
const defaultSelectedUid = params.name;
|
||||||
const { sideMenuRef } = props;
|
const { sideMenuRef } = props;
|
||||||
const ctx = useACLRoleContext();
|
const ctx = useACLRoleContext();
|
||||||
const route = useRoute();
|
|
||||||
const [current, setCurrent] = useState(null);
|
const [current, setCurrent] = useState(null);
|
||||||
const onSelect = ({ item }) => {
|
const onSelect = ({ item }) => {
|
||||||
const schema = item.props.schema;
|
const schema = item.props.schema;
|
||||||
|
@ -3,7 +3,6 @@ import {
|
|||||||
ActionContextProvider,
|
ActionContextProvider,
|
||||||
AdminProvider,
|
AdminProvider,
|
||||||
RemoteSchemaComponent,
|
RemoteSchemaComponent,
|
||||||
useRoute,
|
|
||||||
useSystemSettings,
|
useSystemSettings,
|
||||||
useViewport,
|
useViewport,
|
||||||
} from '@nocobase/client';
|
} from '@nocobase/client';
|
||||||
@ -79,7 +78,6 @@ const useMobileSchemaUid = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const MApplication: React.FC = (props) => {
|
const MApplication: React.FC = (props) => {
|
||||||
const route = useRoute();
|
|
||||||
const mobileSchemaUid = useMobileSchemaUid();
|
const mobileSchemaUid = useMobileSchemaUid();
|
||||||
console.log('mobileSchemaUid', mobileSchemaUid);
|
console.log('mobileSchemaUid', mobileSchemaUid);
|
||||||
const params = useParams<{ name: string }>();
|
const params = useParams<{ name: string }>();
|
||||||
|
Loading…
Reference in New Issue
Block a user