Fixed tenant management
This commit is contained in:
@@ -65,6 +65,7 @@ import {
|
||||
ActivityStatus,
|
||||
Tenant,
|
||||
TenantOrganisation,
|
||||
TenantUser,
|
||||
CreateTenantRequest,
|
||||
UpdateTenantRequest,
|
||||
Beneficiary,
|
||||
@@ -1632,6 +1633,26 @@ export const getTenantOrganisations = async (tenantId: string | number): Promise
|
||||
}
|
||||
};
|
||||
|
||||
export const getTenantUsers = async (tenantId: string | number): Promise<TenantUser[]> => {
|
||||
const hashedTenantId = await toolsService.encodeId(tenantId);
|
||||
try {
|
||||
const res = await apiClient.get<TenantUser[]>(
|
||||
`/v1/api/governance/tenants/${encodeURIComponent(hashedTenantId)}/users`
|
||||
);
|
||||
return res.data || [];
|
||||
} catch (err: any) {
|
||||
if (String(tenantId) !== String(hashedTenantId)) {
|
||||
try {
|
||||
const fallbackRes = await apiClient.get<TenantUser[]>(
|
||||
`/v1/api/governance/tenants/${encodeURIComponent(String(tenantId))}/users`
|
||||
);
|
||||
return fallbackRes.data || [];
|
||||
} catch {}
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
// ==========================================
|
||||
// 10. Projects: Beneficiaries & Outcomes APIs
|
||||
// ==========================================
|
||||
|
||||
Reference in New Issue
Block a user