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