From 7f38933e378b24fa3990d056ad2ac7960ada2ca4 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Thu, 8 Aug 2024 09:18:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20success=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/request-client/request-client.ts | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/packages/effects/request/src/request-client/request-client.ts b/packages/effects/request/src/request-client/request-client.ts index df3f1dc5..11c1b56c 100644 --- a/packages/effects/request/src/request-client/request-client.ts +++ b/packages/effects/request/src/request-client/request-client.ts @@ -187,6 +187,20 @@ class RequestClient { return this.request(url, { ...config, method: 'DELETE' }); } + /** + * DELETE请求方法 成功会弹出msg + */ + public deleteWithMsg( + url: string, + config?: AxiosRequestConfig, + ): Promise { + return this.request(url, { + ...config, + method: 'DELETE', + successMessageMode: 'message', + }); + } + /** * GET请求方法 */ @@ -205,6 +219,22 @@ class RequestClient { return this.request(url, { ...config, data, method: 'POST' }); } + /** + * POST请求方法 成功会弹出msg + */ + public postWithMsg( + url: string, + data?: any, + config?: AxiosRequestConfig, + ): Promise { + return this.request(url, { + ...config, + data, + method: 'POST', + successMessageMode: 'message', + }); + } + /** * PUT请求方法 */ @@ -216,6 +246,22 @@ class RequestClient { return this.request(url, { ...config, data, method: 'PUT' }); } + /** + * PUT请求方法 成功会弹出msg + */ + public putWithMsg( + url: string, + data?: any, + config?: AxiosRequestConfig, + ): Promise { + return this.request(url, { + ...config, + data, + method: 'PUT', + successMessageMode: 'message', + }); + } + /** * 通用的请求方法 */