|
@@ -1,6 +1,7 @@
|
|
|
import axios from 'axios'
|
|
|
import router from '../router'
|
|
|
import { getCookieValue } from '../utils'
|
|
|
+import { platform } from '../utils/platform'
|
|
|
|
|
|
const request = axios.create({
|
|
|
withCredentials: true,
|
|
@@ -10,10 +11,17 @@ const request = axios.create({
|
|
|
'Content-Type': 'application/json;charset=UTF-8'
|
|
|
}
|
|
|
})
|
|
|
+let tingbangSource = 'h5'
|
|
|
+if (platform.isAlipay) {
|
|
|
+ tingbangSource = 'alipay'
|
|
|
+} else if (platform.isWeixin) {
|
|
|
+ tingbangSource = 'wechat'
|
|
|
+}
|
|
|
|
|
|
// Add a request interceptor
|
|
|
request.interceptors.request.use(request => {
|
|
|
request.headers.token = getCookieValue('afhousetoken')
|
|
|
+ request.headers.tingbangSource = tingbangSource
|
|
|
return request
|
|
|
}, error => {
|
|
|
// Do something with request error
|