Refactored UI
Added Role filed to user table and endpoint implementation
This commit is contained in:
@@ -1688,8 +1688,33 @@ export const updateChangeRequest = async (payload: UpdateChangeRequest): Promise
|
||||
// ==========================================
|
||||
export const getProjectComplianceItems = async (projectId: string | number): Promise<ComplianceItem[]> => {
|
||||
const hashedProjectId = await toolsService.resolveProjectId(projectId);
|
||||
const res = await apiClient.get<ComplianceItem[]>(`/v1/api/projects/complianceitems/${hashedProjectId}`);
|
||||
return res.data || [];
|
||||
try {
|
||||
// Primary updated route: /v1/api/projects/{projectId}/complianceitems
|
||||
const res = await apiClient.get<ComplianceItem[]>(`/v1/api/projects/${hashedProjectId}/complianceitems`);
|
||||
return res.data || [];
|
||||
} catch (err: any) {
|
||||
if (err?.response?.status === 404 || err?.response?.status === 400) {
|
||||
try {
|
||||
// Fallback without /v1 prefix: /api/projects/{projectId}/complianceitems
|
||||
const fallbackRes = await apiClient.get<ComplianceItem[]>(`/api/projects/${hashedProjectId}/complianceitems`);
|
||||
return fallbackRes.data || [];
|
||||
} catch {
|
||||
try {
|
||||
// Unencoded project ID fallbacks
|
||||
const rawIdRes = await apiClient.get<ComplianceItem[]>(`/v1/api/projects/${projectId}/complianceitems`);
|
||||
return rawIdRes.data || [];
|
||||
} catch {
|
||||
try {
|
||||
const rawApiRes = await apiClient.get<ComplianceItem[]>(`/api/projects/${projectId}/complianceitems`);
|
||||
return rawApiRes.data || [];
|
||||
} catch {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
export const getComplianceItem = async (complianceItemId: string | number): Promise<ComplianceItem> => {
|
||||
|
||||
Reference in New Issue
Block a user