From dc643ba44fd2a426263015491268a0f0d6b4671d Mon Sep 17 00:00:00 2001
From: lrj <owen.stl@gmail.com>
Date: 星期三, 01 十月 2025 08:39:29 +0800
Subject: [PATCH] 删除包含test、check、fix的文件名的文件

---
 web/src/config/api.ts |   59 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 41 insertions(+), 18 deletions(-)

diff --git a/web/src/config/api.ts b/web/src/config/api.ts
index 485abb2..62cf341 100644
--- a/web/src/config/api.ts
+++ b/web/src/config/api.ts
@@ -17,36 +17,59 @@
 
 // GraphQL璇锋眰宸ュ叿鍑芥暟
 export const graphqlRequest = async (query: string, variables: any = {}) => {
+  console.log('=== GraphQL璇锋眰寮�濮� ===');
+  console.log('璇锋眰绔偣:', API_CONFIG.GRAPHQL_ENDPOINT);
+  console.log('鏌ヨ璇彞:', query);
+  console.log('鍙橀噺:', variables);
+  
   // 鑾峰彇JWT token
   const { getToken } = await import('@/utils/auth');
   const token = getToken();
+  console.log('JWT Token:', token ? '宸茶幏鍙�' : '鏈幏鍙�');
+  
   const headers: Record<string, string> = {
     'Content-Type': 'application/json',
   };
   if (token) {
     headers['Authorization'] = `Bearer ${token}`;
   }
+  console.log('璇锋眰澶�:', headers);
 
-  const response = await fetch(API_CONFIG.GRAPHQL_ENDPOINT, {
-    method: 'POST',
-    headers: headers,
-    body: JSON.stringify({
-      query,
-      variables,
-    }),
-  })
+  const requestBody = JSON.stringify({
+    query,
+    variables,
+  });
+  console.log('璇锋眰浣�:', requestBody);
 
-  if (!response.ok) {
-    throw new Error(`HTTP error! status: ${response.status}`)
+  try {
+    const response = await fetch(API_CONFIG.GRAPHQL_ENDPOINT, {
+      method: 'POST',
+      headers: headers,
+      body: requestBody,
+    })
+
+    console.log('鍝嶅簲鐘舵��:', response.status);
+    console.log('鍝嶅簲鐘舵�佹枃鏈�:', response.statusText);
+
+    if (!response.ok) {
+      throw new Error(`HTTP error! status: ${response.status}`)
+    }
+
+    const result = await response.json()
+    console.log('鍝嶅簲缁撴灉:', result);
+    
+    if (result.errors) {
+      console.error('GraphQL閿欒:', result.errors);
+      throw new Error(result.errors[0].message)
+    }
+
+    console.log('杩斿洖鏁版嵁:', result.data);
+    return result.data
+  } catch (error) {
+    console.error('=== GraphQL璇锋眰澶辫触 ===');
+    console.error('閿欒璇︽儏:', error);
+    throw error;
   }
-
-  const result = await response.json()
-  
-  if (result.errors) {
-    throw new Error(result.errors[0].message)
-  }
-
-  return result.data
 }
 
 // 閫氱敤API璇锋眰宸ュ叿鍑芥暟

--
Gitblit v1.8.0