mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-09 15:39:24 +08:00
31 lines
680 B
TypeScript
31 lines
680 B
TypeScript
import { App } from 'antd';
|
|
import React, { memo, useEffect } from 'react';
|
|
import { useAPIClient } from '../api-client';
|
|
|
|
const AppInner = memo(({ children }: { children: React.ReactNode }) => {
|
|
const { notification } = App.useApp();
|
|
const apiClient = useAPIClient();
|
|
|
|
useEffect(() => {
|
|
apiClient.notification = notification;
|
|
}, [notification]);
|
|
|
|
return <>{children}</>;
|
|
});
|
|
|
|
const AntdAppProvider = ({ children }: { children: React.ReactNode }) => {
|
|
return (
|
|
<App
|
|
style={{
|
|
height: '100%',
|
|
}}
|
|
>
|
|
<AppInner>{children}</AppInner>
|
|
</App>
|
|
);
|
|
};
|
|
|
|
AntdAppProvider.displayName = 'AntdAppProvider';
|
|
|
|
export default AntdAppProvider;
|