From 4b095a853c5cb55379b9e708430fb1367b85a8c3 Mon Sep 17 00:00:00 2001 From: luyuan <1162963624@qq.com> Date: Wed, 14 Oct 2020 15:33:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0del=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/base.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/api/base.ts b/src/api/base.ts index a859850..72c378d 100644 --- a/src/api/base.ts +++ b/src/api/base.ts @@ -17,13 +17,18 @@ axios.interceptors.response.use((response)=>{ return Promise.reject(error) }) -const get: Get = async function (url: string,data?: unknown) { - const res = await axios.get(url,{params:data}); +const get: Get = async function (url: string, data?: unknown) { + const res = await axios.get(url, {params:data}); return res.data; } -const post: Get = async function (url: string,data?: unknown) { - const res = await axios.post(url,data) +const post: Get = async function (url: string, data?: unknown) { + const res = await axios.post(url, data) + return res.data; +} + +const del: Get = async function (url: string, data?: unknown){ + const res = await axios.delete(url, {params:data}) return res.data; } @@ -34,5 +39,6 @@ function setToken(){ export { get, post, + del, setToken } \ No newline at end of file