diff --git a/src/client/dd-hub-react/src/_mock/_data.ts b/src/client/dd-hub-react/src/_mock/_data.ts index c37fc23..99b29c5 100644 --- a/src/client/dd-hub-react/src/_mock/_data.ts +++ b/src/client/dd-hub-react/src/_mock/_data.ts @@ -559,5 +559,6 @@ export function _genFile(name: string): Uint8Array | undefined { case "report.docx": return base64ToUint8Array(_base64.report_docx); default: + return undefined; } } \ No newline at end of file diff --git a/src/client/dd-hub-react/src/sections/document/view/doc-search-view.tsx b/src/client/dd-hub-react/src/sections/document/view/doc-search-view.tsx index fa1a779..915d1b1 100644 --- a/src/client/dd-hub-react/src/sections/document/view/doc-search-view.tsx +++ b/src/client/dd-hub-react/src/sections/document/view/doc-search-view.tsx @@ -40,7 +40,7 @@ export function DocSearchView() { const [docs, setDocs] = useState([]); useEffect(() => { - docService.getDocuments({}).then((res) => { + docService.get({}).then((res) => { setDocs(res); }); }, []); @@ -49,7 +49,7 @@ export function DocSearchView() { const [attributes, setAttributes] = useState>({}); useEffect(() => { - docService.getDocumentByAttributes(attributes).then(setDocs); + docService.getByAttribute(attributes).then(setDocs); }, [attributes]); function setAttribute(name: string, serilizedValue: string) { diff --git a/src/client/dd-hub-react/src/services/document-service.ts b/src/client/dd-hub-react/src/services/document-service.ts index 7487369..1aa9c38 100644 --- a/src/client/dd-hub-react/src/services/document-service.ts +++ b/src/client/dd-hub-react/src/services/document-service.ts @@ -78,7 +78,7 @@ export type DocQuery = { } class DocService { - getDocuments(query: DocQuery | undefined = undefined): Promise { + get(query: DocQuery | undefined = undefined): Promise { let documents = _documents; if (query?.id) @@ -95,16 +95,16 @@ class DocService { return Promise.resolve(documents); } - getDocumentById(id: number): Promise { - return this.getDocuments({ id: id }); + getById(id: number): Promise { + return this.get({ id: id }); } - getDocumentByName(name: string): Promise { - return this.getDocuments({ name: name }); + getByName(name: string): Promise { + return this.get({ name: name }); } - getDocumentByAttributes(attributes: Record): Promise { - return this.getDocuments({ attributes: attributes }); + getByAttribute(attributes: Record): Promise { + return this.get({ attributes: attributes }); } }