修改调用路径后未加跨域参数的问题

This commit is contained in:
何童崇 2021-11-10 10:39:08 +08:00
parent a59a8c3693
commit c3ecbe1f97
2 changed files with 5 additions and 5 deletions

View File

@ -5,7 +5,7 @@ import cookie from 'react-cookies';
let settings=JSON.parse(localStorage.chromesetting); let settings=JSON.parse(localStorage.chromesetting);
let actionUrl = settings.api_urls? settings.api_urls.task :'https://task.osredm.com'; let actionUrl = settings.api_urls? settings.api_urls.task :'https://task.osredm.com';
if (window.location.href.indexOf('localhost') < -1) { if (window.location.href.indexOf('localhost') < 0) {
axios.defaults.withCredentials = true; axios.defaults.withCredentials = true;
} }
export const httpUrl = actionUrl; export const httpUrl = actionUrl;

View File

@ -1,11 +1,11 @@
import { notification, message } from 'antd'; import { notification } from 'antd';
import axios from 'axios'; import axios from 'axios';
import cookie from 'react-cookies'; import cookie from 'react-cookies';
let settings=JSON.parse(localStorage.chromesetting); let settings = JSON.parse(localStorage.chromesetting);
let actionUrl = settings.api_urls? settings.api_urls.notice :'https://info.osredm.com'; let actionUrl = settings.api_urls ? settings.api_urls.notice : 'https://info.osredm.com';
if (window.location.href.indexOf('localhost') < -1) { if (window.location.href.indexOf('localhost')< 0) {
axios.defaults.withCredentials = true; axios.defaults.withCredentials = true;
} }
export const httpUrl = actionUrl; export const httpUrl = actionUrl;