@aplus-frontend/aplus-axios-react-preset
A 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/
Usage with App Context (Recommended)
To avoid the warning about static functions not consuming context, you can pass the antd App instances to the preset:
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();
const basePlugin = axiosReactPresent({
locale: 'zh_CN',
modal,
message,
notification
});
defHttp.use(basePlugin);
}
function Root() {
return (
<App>
<MyApp />
</App>
);
}
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).