haiwei-ui 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haiwei-ui",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "HaiWei前端组件库",
5
5
  "author": "Eric",
6
6
  "license": "ISC",
@@ -197,7 +197,7 @@ export default config => {
197
197
 
198
198
  // 开发环境下打印请求日志
199
199
  if (process.env.NODE_ENV === 'development') {
200
- console.group(`🌐 API请求 ${config.method.toUpperCase()} ${config.url}`)
200
+ console.group(`[API请求] ${config.method.toUpperCase()} ${config.url}`)
201
201
  console.log('请求配置:', {
202
202
  方法: config.method,
203
203
  URL: config.url,
@@ -213,7 +213,7 @@ export default config => {
213
213
  function(error) {
214
214
  // 开发环境下打印请求错误日志
215
215
  if (process.env.NODE_ENV === 'development') {
216
- console.error('❌ 请求拦截器错误:', error)
216
+ console.error('[请求拦截器错误]:', error)
217
217
  }
218
218
  return Promise.reject(error)
219
219
  }
@@ -226,7 +226,7 @@ export default config => {
226
226
 
227
227
  // 开发环境下打印响应成功日志
228
228
  if (process.env.NODE_ENV === 'development') {
229
- console.group(`✅ API响应 ${config.method.toUpperCase()} ${config.url}`)
229
+ console.group(`[API响应] ${config.method.toUpperCase()} ${config.url}`)
230
230
  console.log('响应信息:', {
231
231
  状态码: response.status,
232
232
  状态文本: response.statusText,
@@ -257,11 +257,16 @@ export default config => {
257
257
  error => {
258
258
  // 开发环境下打印响应错误日志
259
259
  if (process.env.NODE_ENV === 'development') {
260
- console.group(`❌ API错误 ${error.config?.method?.toUpperCase()} ${error.config?.url}`)
260
+ const method = error.config && error.config.method ? error.config.method.toUpperCase() : 'UNKNOWN'
261
+ const url = error.config && error.config.url ? error.config.url : 'unknown'
262
+ const status = error.response && error.response.status
263
+ const responseData = error.response && error.response.data
264
+
265
+ console.group(`[API错误] ${method} ${url}`)
261
266
  console.log('错误信息:', {
262
- 状态码: error.response?.status,
267
+ 状态码: status,
263
268
  错误消息: error.message,
264
- 响应数据: error.response?.data,
269
+ 响应数据: responseData,
265
270
  请求配置: error.config
266
271
  })
267
272
  console.groupEnd()