net4j-loading-plugin
v1.0.12
Published
Handle every request when loading
Downloads
1
Readme
net4j-loading-plugin
Easily to set loading toast when request pending.
import Net from 'net4j';
import { message } from 'antd';
import NetLoading, { PluginConfig } from 'net4j-loading-plugin';
// Merge plugin config to net4j config,then you can use it in every requst in net4j
declare module 'net4j' {
interface Config extends PluginConfig {}
}
const net = new Net({
plugins: [
new NetLoading({
loading: message.loading,
defaultLoadingText: '加载中...', // Default is 'loading'
}),
]
});
// When api/goods is pending, message loading will display and close when request finish;
await net.get('api/goods');