251210:1709 Frontend: reeactor organization and run build
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled

This commit is contained in:
admin
2025-12-10 17:09:11 +07:00
parent aa96cd90e3
commit c8a0f281ef
140 changed files with 3780 additions and 1473 deletions

View File

@@ -16,6 +16,10 @@ export const projectService = {
getAll: async (params?: SearchProjectDto) => {
// GET /projects
const response = await apiClient.get("/projects", { params });
// Handle paginated response
if (response.data && Array.isArray(response.data.data)) {
return response.data.data;
}
return response.data;
},
@@ -57,9 +61,27 @@ export const projectService = {
/** * ดึงรายชื่อสัญญาในโครงการ
* GET /projects/:id/contracts
*/
/** * ดึงรายชื่อสัญญาในโครงการ (Legacy/Specific)
* GET /projects/:id/contracts
*/
getContracts: async (projectId: string | number) => {
const response = await apiClient.get(`/projects/${projectId}/contracts`);
// Unwrap the response data if it's wrapped in a 'data' property by the interceptor
// Note: If backend doesn't have /projects/:id/contracts, use /contracts?projectId=:id
const response = await apiClient.get(`/contracts`, { params: { projectId } });
// Handle paginated response
if (response.data && Array.isArray(response.data.data)) {
return response.data.data;
}
return response.data.data || response.data;
},
/**
* ดึงรายการสัญญาเรื้งหมด (Global Search)
*/
getAllContracts: async (params?: any) => {
const response = await apiClient.get("/contracts", { params });
if (response.data && Array.isArray(response.data.data)) {
return response.data.data;
}
return response.data.data || response.data;
}
};