Browse Source

优化代码

ms
zhoujie 2 years ago
parent
commit
9de4453a1b
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      utils/network/request.js

+ 7
- 1
utils/network/request.js View File

import { import {
encryption encryption
} from "./encryption" } from "./encryption"

import {
getToken
} from '@/utils/storage'
/** /**
* 配置信息,针对不同的平台进行配置 * 配置信息,针对不同的平台进行配置
*/ */
options.header = { options.header = {
'content-type': contentType 'content-type': contentType
} }
const token = getToken();
if (token) {
options.header["Access-Token"] = token;
}
//默认POST提交 //默认POST提交
options.method = options.method ? options.method : 'POST' options.method = options.method ? options.method : 'POST'
//设置请求超时时间 //设置请求超时时间

Loading…
Cancel
Save