Commit 875e989e by MichaelJier

test

parent 0a3cfb51
......@@ -9,7 +9,7 @@
import qs from 'qs';
import axios from 'axios';
import Layer from '@/plugins/Layer/index';
import md5 from 'js-md5';
// import md5 from 'js-md5';
// import LRU from 'lru-cache'
const Cookie = process.client ? require('js-cookie') : {};
const Sentry = process.client ? require('@sentry/browser') : require('@sentry/node');
......@@ -41,6 +41,10 @@ service.interceptors.request.use(
config.headers['token'] =
Cookie.get('token') || Cookie.get('BCC_PROGRAM_USER_LOGIN_TOKEN') || '';
} else {
const { params = {}, headers = {} } = config
Sentry.captureException(
new Error(`${config.url} ; ${JSON.stringify(params)} ; ${JSON.stringify(headers)}`)
)
// 服务端api缓存
// const { params = {}, headers = {} } = config
// const key = md5(config.url + JSON.stringify(params) + JSON.stringify(headers))
......@@ -66,11 +70,14 @@ service.interceptors.response.use(
const { status, data, config } = res;
if (status === 200) {
const { code, errorCode, errorMessage } = data;
// if (!process.client) {
// const { params = {}, headers = {} } = config
// const key = md5(config.url + JSON.stringify(params) + JSON.stringify(headers))
// CACHED.set(key, data)
// }
if (!process.client) {
// const { params = {}, headers = {} } = config
// const key = md5(config.url + JSON.stringify(params) + JSON.stringify(headers))
// CACHED.set(key, data)
Sentry.captureException(
new Error(`${status};${JSON.stringify(data)};${JSON.stringify(config)}`)
);
}
if ((code !== 200 || errorCode !== 0) && code !== 0) {
Sentry.captureException(
new Error(`${status};${JSON.stringify(data)};${JSON.stringify(config)}`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment