Browse Source

feat: save

gemercheung 7 months ago
parent
commit
b9a50ce470

+ 5 - 6
packages/backend/src/modules/web/web.controller.ts

@@ -22,14 +22,13 @@ export class WebController {
     return this.webService.setArticleCount(+id);
   }
 
-  @Get('what')
-  getArticleWithSearch(@Query('key') key: string, @Headers('locale') locale?: string) {
-    return this.webService.searchArticles(key, locale);
-    // return true;
-  }
-
   @Get('category/tree')
   getCategoryTree(@Query('id') id: string) {
     return this.webService.getCategoryTreeAndPath(+id);
   }
+
+  @Get('search')
+  getArticleWithSearch(@Query('key') key: string, @Headers('locale') locale?: string) {
+    return this.webService.searchArticles(key, locale);
+  }
 }

+ 3 - 0
packages/web/src/api/article.ts

@@ -20,3 +20,6 @@ export const getArticleDetail = (id: number): Promise<ResultData<ArticleDetailTy
 
 export const getArticleCount = (id: number): Promise<ResultData<boolean>> =>
   request.get(`web/article/count/${id}`)
+
+export const getArticleSearch = (keyword: number): Promise<ResultData<boolean>> =>
+  request.get(`web/search`, { key: keyword })

+ 0 - 1
packages/web/src/utils/index.ts

@@ -1,4 +1,3 @@
 export * from './http'
 export * from './html'
 export * from './time'
-export * from './getTopParentId'

packages/web/src/utils/getTopParentId.ts → packages/web/src/utils/tree.ts