提交 239a06c1 authored 作者: 钟是志's avatar 钟是志

// 2023年11月28日 顺哥说的 延职 要传成 include;

上级 1d9ea0a2
...@@ -64,7 +64,7 @@ const errorHandler = (error) => { ...@@ -64,7 +64,7 @@ const errorHandler = (error) => {
*/ */
const umiRequest = extend({ const umiRequest = extend({
errorHandler, // 默认错误处理 errorHandler, // 默认错误处理
credentials: 'omit', // 默认请求是否带上cookie credentials: 'include', // 默认请求是否带上cookie
mode: 'cors', mode: 'cors',
}); });
......
...@@ -59,7 +59,7 @@ function getApi(apiUrl) { ...@@ -59,7 +59,7 @@ function getApi(apiUrl) {
Accept: 'application/json', Accept: 'application/json',
}, },
method: 'POST', method: 'POST',
credentials: 'omit', credentials: 'include',
mode: 'cors', mode: 'cors',
body: formData, body: formData,
}) })
......
...@@ -23,7 +23,7 @@ const token = getToken(); ...@@ -23,7 +23,7 @@ const token = getToken();
const umiRequest = extend({ const umiRequest = extend({
// errorHandler, // 默认错误处理 // errorHandler, // 默认错误处理
credentials: 'omit', // 默认请求是否带上cookie credentials: 'include', // 默认请求是否带上cookie
mode: 'cors', mode: 'cors',
}); });
......
...@@ -163,9 +163,11 @@ export async function request(url, data, options = {}) { ...@@ -163,9 +163,11 @@ export async function request(url, data, options = {}) {
export async function requestOrigin(url, data, options = {}){ export async function requestOrigin(url, data, options = {
credentials: 'include',
}){
console.log(options);
let version = getVersion(); let version = getVersion();
...@@ -194,6 +196,7 @@ export async function requestOrigin(url, data, options = {}){ ...@@ -194,6 +196,7 @@ export async function requestOrigin(url, data, options = {}){
// method: "POST", // method: "POST",
requestType: 'form', requestType: 'form',
credentials: 'include',
...getHeaders(url), ...getHeaders(url),
...options, ...options,
...@@ -389,7 +392,7 @@ export const dynamicRequest = createServerRequest({ ...@@ -389,7 +392,7 @@ export const dynamicRequest = createServerRequest({
export const noPrefixRequest = createServerRequest({ export const noPrefixRequest = createServerRequest({
method: 'POST', method: 'POST',
prefix: '', prefix: '',
credentials: 'omit', credentials: 'include',
mode: 'cors', mode: 'cors',
}); });
...@@ -416,7 +419,7 @@ export const getRequest = createServerRequest({ ...@@ -416,7 +419,7 @@ export const getRequest = createServerRequest({
export const getUiaRequest = (data) => { // 2.0的登录接口 export const getUiaRequest = (data) => { // 2.0的登录接口
return fetch(queryUiaApi() + '/oauth/token', { return fetch(queryUiaApi() + '/oauth/token', {
credentials: 'omit', credentials: 'include',
mode: 'cors', mode: 'cors',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
......
...@@ -103,7 +103,7 @@ export default class LoginWithQrCode extends Component { ...@@ -103,7 +103,7 @@ export default class LoginWithQrCode extends Component {
getAppId = () => { getAppId = () => {
const options = { const options = {
body: FormdataWrapper({}), body: FormdataWrapper({}),
credentials: 'omit', credentials: 'include',
mode: 'cors', mode: 'cors',
method: 'POST', method: 'POST',
headers: { headers: {
......
...@@ -10,7 +10,7 @@ export default function fetchJSON(url, body) { ...@@ -10,7 +10,7 @@ export default function fetchJSON(url, body) {
return fetch(url, { return fetch(url, {
method: 'post', method: 'post',
body: JSON.stringify(body), body: JSON.stringify(body),
credentials: 'omit', // 确保浏览器不在请求中包含凭据 // 用这个本地访问北电科会跨域 credentials: 'include', // 确保浏览器不在请求中包含凭据 // 用这个本地访问北电科会跨域
mode: 'cors', mode: 'cors',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
......
...@@ -91,7 +91,7 @@ export default function requestJson(url, options) { ...@@ -91,7 +91,7 @@ export default function requestJson(url, options) {
} }
} }
const defaultOptions = { const defaultOptions = {
credentials: 'omit', credentials: 'include',
mode: 'cors', mode: 'cors',
}; };
let newOptions = { ...defaultOptions, ...options }; let newOptions = { ...defaultOptions, ...options };
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论