fix: 修复4个已知BUG — P1 ChatList/P2 错误密码/P3 Copilot崩溃/P3超管entrypoint
P1: ChatList.vue — 添加 conversationStats watch fallback,检测 stats>0
但 chatList 为空时自动触发 fetchConversations
P2: api.js parseAPIErrorResponse — 处理 error 字段为对象时提取 .message
P3: CopilotContainer.vue — activeAssistant 判空保护
P3: 新建 super_admin.html + vite.config.ts rewrite 规则
(注:entrypoint 仅含样式,Vue应用代码待补)
防御: NotificationTable.vue — 可选链保护 primary_actor.meta 路径
This commit is contained in:
@@ -92,12 +92,27 @@ export const parseAPIErrorResponse = error => {
|
||||
return error?.response?.data?.message;
|
||||
}
|
||||
if (error?.response?.data?.error) {
|
||||
return error?.response?.data?.error;
|
||||
// error could be a string or an object with a message property
|
||||
if (typeof error.response.data.error === 'string') {
|
||||
return error.response.data.error;
|
||||
}
|
||||
if (error.response.data.error?.message) {
|
||||
return error.response.data.error.message;
|
||||
}
|
||||
return JSON.stringify(error.response.data.error);
|
||||
}
|
||||
if (error?.response?.data?.errors) {
|
||||
return error?.response?.data?.errors[0];
|
||||
const first = error.response.data.errors;
|
||||
if (Array.isArray(first)) {
|
||||
return first[0];
|
||||
}
|
||||
return first;
|
||||
}
|
||||
return error;
|
||||
// Fallback: return a useful default message rather than the raw error object
|
||||
if (error?.message && typeof error.message === 'string') {
|
||||
return error.message;
|
||||
}
|
||||
return 'Request failed. Please try again.';
|
||||
};
|
||||
|
||||
export const throwErrorMessage = error => {
|
||||
|
||||
Reference in New Issue
Block a user