mirror of
https://github.com/ccmjga/zhilu-admin
synced 2026-03-14 05:33:42 +08:00
优化表单提交错误处理逻辑,调整错误提示的属性名称;移除未使用的文档获取函数,简化知识查询逻辑。
This commit is contained in:
@@ -78,14 +78,14 @@ const handleSubmit = async () => {
|
||||
} catch (error) {
|
||||
if (error instanceof z.ZodError) {
|
||||
alertStore.showAlert({
|
||||
type: "error",
|
||||
message: error.errors[0].message,
|
||||
level: "error",
|
||||
content: error.errors[0].message,
|
||||
});
|
||||
} else {
|
||||
console.error("表单提交错误:", error);
|
||||
alertStore.showAlert({
|
||||
type: "error",
|
||||
message: "表单提交失败,请重试",
|
||||
level: "error",
|
||||
content: "表单提交失败,请重试",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,17 +30,6 @@ export const useKnowledgeQuery = () => {
|
||||
docs.value = data || [];
|
||||
};
|
||||
|
||||
const fetchDocById = async (docId: number) => {
|
||||
const { data } = await client.GET("/knowledge/docs", {
|
||||
params: {
|
||||
query: {},
|
||||
},
|
||||
});
|
||||
if (data && Array.isArray(data)) {
|
||||
doc.value = data.find((item) => item.id === docId) || null;
|
||||
}
|
||||
};
|
||||
|
||||
const fetchDocSegments = async (params: SegmentQueryParams) => {
|
||||
const { data } = await client.GET("/knowledge/segments", {
|
||||
params: {
|
||||
@@ -58,7 +47,6 @@ export const useKnowledgeQuery = () => {
|
||||
docs,
|
||||
fetchLibraryDocs,
|
||||
doc,
|
||||
fetchDocById,
|
||||
segments,
|
||||
fetchDocSegments,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user