feat: 添加mock数据

This commit is contained in:
zdl
2025-11-05 17:43:17 +08:00
parent c3ef837221
commit 22186eb54a

View File

@@ -82,4 +82,30 @@ export const posthogHandlers = [
); );
} }
}), }),
// PostHog session recording 接口(会话录制)
http.post('https://us.i.posthog.com/s/', async ({ request }) => {
try {
const body = await request.text();
if (process.env.NODE_ENV === 'development' && process.env.REACT_APP_LOG_POSTHOG === 'true') {
console.log('[Mock] PostHog session recording 请求:', {
url: request.url,
bodyPreview: body.substring(0, 100) + (body.length > 100 ? '...' : ''),
});
}
// 返回成功响应
return HttpResponse.json(
{ status: 1 },
{ status: 200 }
);
} catch (error) {
console.error('[Mock] PostHog session recording handler error:', error);
return HttpResponse.json(
{ status: 0, error: 'Mock handler error' },
{ status: 500 }
);
}
}),
]; ];