251208:0010 Backend & Frontend Debug
This commit is contained in:
@@ -10,12 +10,24 @@ export const searchService = {
|
||||
search: async (query: SearchQueryDto) => {
|
||||
// ส่ง params แบบ flat ตาม DTO
|
||||
// GET /search?q=...&type=...&projectId=...
|
||||
const response = await apiClient.get("/search", {
|
||||
params: query
|
||||
const response = await apiClient.get("/search", {
|
||||
params: query
|
||||
});
|
||||
return response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Suggestion (Autocomplete)
|
||||
* ใช้ search endpoint แต่จำกัดจำนวน
|
||||
*/
|
||||
suggest: async (query: string) => {
|
||||
const response = await apiClient.get("/search", {
|
||||
params: { q: query, limit: 5 }
|
||||
});
|
||||
// Assuming backend returns { items: [], ... } or just []
|
||||
return response.data.items || response.data;
|
||||
},
|
||||
|
||||
/**
|
||||
* (Optional) Re-index ข้อมูลใหม่ กรณีข้อมูลไม่ตรง (Admin Only)
|
||||
*/
|
||||
@@ -23,4 +35,4 @@ export const searchService = {
|
||||
const response = await apiClient.post("/search/reindex", { type });
|
||||
return response.data;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user