mirror of
https://gitee.com/dapppp/ruoyi-plus-vben5.git
synced 2026-04-09 09:33:14 +08:00
refactor(http): 统一HTTP方法命名并添加消息提示功能
将大写的HTTP方法改为小写命名以提高一致性 添加带消息提示的HTTP方法变体
This commit is contained in:
@@ -326,11 +326,27 @@ const alovaInstance = createAlova({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
alovaInstance.get = function (url, options) {
|
||||||
|
return this.Get(url, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
alovaInstance.post = function (url, data, config) {
|
||||||
|
return this.Post(url, data, config);
|
||||||
|
};
|
||||||
|
|
||||||
|
alovaInstance.put = function (url, data, config) {
|
||||||
|
return this.Put(url, data, config);
|
||||||
|
};
|
||||||
|
|
||||||
|
alovaInstance.delete = function (url, data, config) {
|
||||||
|
return this.Delete(url, data, config);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
提供xxWithMessage方法,用于请求成功后弹出提示
|
提供xxWithMessage方法,用于请求成功后弹出提示
|
||||||
*/
|
*/
|
||||||
|
|
||||||
alovaInstance.GetWithMessage = function (url, options) {
|
alovaInstance.getWithMsg = function (url, options) {
|
||||||
return this.Get(url, {
|
return this.Get(url, {
|
||||||
...options,
|
...options,
|
||||||
meta: {
|
meta: {
|
||||||
@@ -340,7 +356,7 @@ alovaInstance.GetWithMessage = function (url, options) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
alovaInstance.PostWithMessage = function (url, data, config) {
|
alovaInstance.postWithMsg = function (url, data, config) {
|
||||||
return this.Post(url, data, {
|
return this.Post(url, data, {
|
||||||
...config,
|
...config,
|
||||||
meta: {
|
meta: {
|
||||||
@@ -350,7 +366,7 @@ alovaInstance.PostWithMessage = function (url, data, config) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
alovaInstance.PutWithMessage = function (url, data, config) {
|
alovaInstance.putWithMsg = function (url, data, config) {
|
||||||
return this.Put(url, data, {
|
return this.Put(url, data, {
|
||||||
...config,
|
...config,
|
||||||
meta: {
|
meta: {
|
||||||
@@ -360,7 +376,7 @@ alovaInstance.PutWithMessage = function (url, data, config) {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
alovaInstance.DeleteWithMessage = function (url, data, config) {
|
alovaInstance.deleteWithMsg = function (url, data, config) {
|
||||||
return this.Delete(url, data, {
|
return this.Delete(url, data, {
|
||||||
...config,
|
...config,
|
||||||
meta: {
|
meta: {
|
||||||
|
|||||||
13
apps/web-antd/types/alova.d.ts
vendored
13
apps/web-antd/types/alova.d.ts
vendored
@@ -49,10 +49,15 @@ declare module 'alova' {
|
|||||||
* 添加withMessage方法 用于success弹窗
|
* 添加withMessage方法 用于success弹窗
|
||||||
*/
|
*/
|
||||||
interface Alova {
|
interface Alova {
|
||||||
GetWithMessage: GetType;
|
get: GetType;
|
||||||
PostWithMessage: PostType;
|
post: PostType;
|
||||||
PutWithMessage: PutType;
|
put: PutType;
|
||||||
DeleteWithMessage: DeleteType;
|
delete: DeleteType;
|
||||||
|
// 添加withMessage方法 用于弹出message提示
|
||||||
|
getWithMsg: GetType;
|
||||||
|
postWithMsg: PostType;
|
||||||
|
putWithMsg: PutType;
|
||||||
|
deleteWithMsg: DeleteType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user