feat: 添加mock数据
This commit is contained in:
@@ -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 }
|
||||
);
|
||||
}
|
||||
}),
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user