fix(acl): import SettingsCenterContext
This commit is contained in:
		
							parent
							
								
									7e9f3dfa17
								
							
						
					
					
						commit
						fe989bb71c
					
				@ -1,7 +1,8 @@
 | 
				
			|||||||
import { Checkbox, message, Table } from 'antd';
 | 
					import { Checkbox, message, Table } from 'antd';
 | 
				
			||||||
import React, { createContext, useContext, useState } from 'react';
 | 
					import React, { createContext, useContext } from 'react';
 | 
				
			||||||
import { useTranslation } from 'react-i18next';
 | 
					import { useTranslation } from 'react-i18next';
 | 
				
			||||||
import { useAPIClient, useRequest } from '../../api-client';
 | 
					import { useAPIClient, useRequest } from '../../api-client';
 | 
				
			||||||
 | 
					import { SettingsCenterContext } from '../../pm';
 | 
				
			||||||
import { useRecord } from '../../record-provider';
 | 
					import { useRecord } from '../../record-provider';
 | 
				
			||||||
import { useCompile } from '../../schema-component';
 | 
					import { useCompile } from '../../schema-component';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -28,19 +29,8 @@ const getChildrenKeys = (data = [], arr = []) => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const SettingMenuContext = createContext(null);
 | 
					const SettingMenuContext = createContext(null);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function useGetContext() {
 | 
					 | 
				
			||||||
  const [context, setContext] = useState(null);
 | 
					 | 
				
			||||||
  import('../../pm').then(({ SettingsCenterContext }) => {
 | 
					 | 
				
			||||||
    setContext(SettingsCenterContext);
 | 
					 | 
				
			||||||
  });
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return context;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export const SettingCenterProvider = (props) => {
 | 
					export const SettingCenterProvider = (props) => {
 | 
				
			||||||
  const context = useGetContext();
 | 
					  const configureItems = useContext(SettingsCenterContext);
 | 
				
			||||||
  const configureItems = context && useContext(context);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  return <SettingMenuContext.Provider value={configureItems}>{props.children}</SettingMenuContext.Provider>;
 | 
					  return <SettingMenuContext.Provider value={configureItems}>{props.children}</SettingMenuContext.Provider>;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user