A react present for @aplus-frontend/axios-core
npm install @aplus-frontend/aplus-axios-react-presetA repackage axios for aplus frontend team,this is a react axios base preset,you must install @aplus-frontend/axios-core at first.
See detail at https://aplus.aplnk.com/aplus-axios/
To avoid the warning about static functions not consuming context, you can pass the antd App instances to the preset:
``tsx
import { App } from 'antd';
import { axiosReactPresent } from '@aplus-frontend/aplus-axios-react-preset';
import { defHttp } from '@aplus-frontend/axios-core';
function MyApp() {
const { modal, message, notification } = App.useApp();
// Initialize axios with App instances
const basePlugin = axiosReactPresent({
locale: 'zh_CN',
modal,
message,
notification
});
defHttp.use(basePlugin);
// ... rest of your app
}
// Wrap your app with App provider
function Root() {
return (
);
}
``
This way, the error modals will properly consume the React context including dynamic themes.
If you don't provide the instances, the preset will fall back to static methods (which work but show a warning).