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