From 17ef65df06ee091554a502c33f4e2069216b67d7 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 29 Mar 2023 00:01:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5=20master=20=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/axios/request.ts | 50 ------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 src/config/axios/request.ts diff --git a/src/config/axios/request.ts b/src/config/axios/request.ts deleted file mode 100644 index d65842c2..00000000 --- a/src/config/axios/request.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { service } from './service' - -import { config } from './config' - -const { default_headers } = config - -const request = (option: any) => { - const { url, method, params, data, headersType, responseType } = option - return service({ - url: url, - method, - params, - data, - responseType: responseType, - headers: { - 'Content-Type': headersType || default_headers - } - }) -} -export default { - get: async (option: any) => { - const res = await request({ method: 'GET', ...option }) - return res as unknown as T - }, - post: async (option: any) => { - const res = await request({ method: 'POST', ...option }) - return res as unknown as T - }, - delete: async (option: any) => { - const res = await request({ method: 'DELETE', ...option }) - return res as unknown as T - }, - put: async (option: any) => { - const res = await request({ method: 'PUT', ...option }) - return res as unknown as T - }, - patch: async (option: any) => { - const res = await request({ method: 'PATCH', ...option }) - return res as unknown as T - }, - download: async (option: any) => { - const res = await request({ method: 'GET', responseType: 'blob', ...option }) - return res as unknown as Promise - }, - upload: async (option: any) => { - option.headersType = 'multipart/form-data' - const res = await request({ method: 'POST', ...option }) - return res as unknown as Promise - } -}