From 513be798a677672644770e2b2f7025b6d4d20414 Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期三, 07 九月 2022 14:44:04 +0800 Subject: [PATCH] 完善登录,登录授权 --- utils/index.js | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/utils/index.js b/utils/index.js index 8b190fc..1c6b914 100644 --- a/utils/index.js +++ b/utils/index.js @@ -7,8 +7,7 @@ "Content-type": 'application/x-www-from-urlencoded' }, headerPOST: { - // "Content-type":'application/json' - 'Content-Type': 'application/x-www-form-urlencoded' + "Content-type":'application/json' }, } @@ -20,17 +19,23 @@ } // get璇锋眰 -export const reqGet = (url, params, opt = {}) => { +// urlParam鏄嫾鎺ヨ矾寰勭殑鍙傛暟 +export const reqGet = (url, params, urlParam, opt = {}) => { opt.header = typeObj['headerGET']; opt.method = "GET"; opt.data = params; - return fetch(url, opt) + return fetch(url, opt ,urlParam) } // post璇锋眰 -export const reqPost = (url, params, opt = {}) => { - opt.header = typeObj['headerPOST']; +export const reqPost = (url, params,form, opt = {}) => { + if(form == 'form'){ + opt.header = {'Content-Type': 'application/x-www-form-urlencoded'} + } else { + opt.header = typeObj['headerPOST']; + } opt.method = "POST"; opt.data = params; + opt.params = params; return fetch(url, opt) } -- Gitblit v1.9.1