删除所有console.log输出,优化评查结果的表格的显示,添加新的页码获取逻辑
This commit is contained in:
+16
-16
@@ -55,22 +55,22 @@ function logPostgrestQuery(endpoint: string, params?: QueryParams, method: strin
|
||||
// 确保 endpoint 格式正确
|
||||
const normalizedEndpoint = endpoint.startsWith('/') ? endpoint.substring(1) : endpoint;
|
||||
|
||||
console.log('\n📦 PostgREST 查询日志 ======================start=============');
|
||||
console.log(`📦 HTTP 方法: ${method}`);
|
||||
console.log(`📦 API 端点: ${decodeUrlForDisplay(`${baseUrl}/${normalizedEndpoint}`)}`);
|
||||
// console.log('\n📦 PostgREST 查询日志 ======================start=============');
|
||||
// console.log(`📦 HTTP 方法: ${method}`);
|
||||
// console.log(`📦 API 端点: ${decodeUrlForDisplay(`${baseUrl}/${normalizedEndpoint}`)}`);
|
||||
|
||||
if (params && Object.keys(params).length > 0) {
|
||||
console.log('📦 查询参数:');
|
||||
// if (params && Object.keys(params).length > 0) {
|
||||
// console.log('📦 查询参数:');
|
||||
|
||||
// 以可读格式单独打印每个参数
|
||||
Object.entries(params).forEach(([key, value]) => {
|
||||
if (value !== undefined) {
|
||||
console.log(` - ${key}: ${JSON.stringify(value)}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
// // 以可读格式单独打印每个参数
|
||||
// Object.entries(params).forEach(([key, value]) => {
|
||||
// if (value !== undefined) {
|
||||
// console.log(` - ${key}: ${JSON.stringify(value)}`);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
console.log('PostgREST 查询日志=============================end============\n');
|
||||
// console.log('PostgREST 查询日志=============================end============\n');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,8 +305,8 @@ export async function postgrestPost<T, D = Record<string, unknown>>(endpoint: st
|
||||
|
||||
// 确保数据是合法的JSON对象
|
||||
const requestBody = JSON.stringify(processedData);
|
||||
console.log(`准备发送 PostgreSQL 插入请求到: ${apiEndpoint}`);
|
||||
console.log(`请求体: ${requestBody}`);
|
||||
// console.log(`准备发送 PostgreSQL 插入请求到: ${apiEndpoint}`);
|
||||
// console.log(`请求体: ${requestBody}`);
|
||||
|
||||
try {
|
||||
const response = await apiRequest<T>(
|
||||
@@ -327,7 +327,7 @@ export async function postgrestPost<T, D = Record<string, unknown>>(endpoint: st
|
||||
throw new Error(response.error);
|
||||
}
|
||||
|
||||
console.log(`POST请求成功,响应: `, response.data);
|
||||
// console.log(`POST请求成功,响应: `, response.data);
|
||||
return { data: response.data as T };
|
||||
} catch (error) {
|
||||
// 捕获并处理 API 请求错误
|
||||
|
||||
Reference in New Issue
Block a user