fix: 修复 MSW 接口和调试代码清理...

This commit is contained in:
zdl
2025-11-06 01:17:06 +08:00
parent ad933e9fb2
commit c5d6247f49
4 changed files with 27 additions and 23 deletions

View File

@@ -13,7 +13,7 @@ export const eventHandlers = [
// ==================== 事件列表相关 ====================
// 获取事件列表
http.get('/api/events/', async ({ request }) => {
http.get('/api/events', async ({ request }) => {
await delay(500);
const url = new URL(request.url);
@@ -41,11 +41,26 @@ export const eventHandlers = [
});
} catch (error) {
console.error('[Mock] 获取事件列表失败:', error);
console.error('[Mock] Error details:', {
message: error.message,
stack: error.stack,
params: params
});
return HttpResponse.json(
{
success: false,
error: '获取事件列表失败',
data: { events: [], pagination: {} }
data: {
events: [],
pagination: {
page: 1,
per_page: 10,
total: 0,
pages: 0, // ← 对齐后端字段名
has_prev: false, // ← 对齐后端
has_next: false // ← 对齐后端
}
}
},
{ status: 500 }
);