fix(core) : align audit entity-types front service with single-resource api shape
This commit is contained in:
@@ -27,9 +27,9 @@ export type AuditLogPage = {
|
||||
totalItems: number
|
||||
}
|
||||
|
||||
export type AuditLogEntityType = {
|
||||
export type AuditLogEntityTypes = {
|
||||
'@id'?: string
|
||||
value: string
|
||||
entityTypes: string[]
|
||||
}
|
||||
|
||||
export function useAuditLogService() {
|
||||
@@ -55,8 +55,10 @@ export function useAuditLogService() {
|
||||
}
|
||||
|
||||
async function entityTypes(): Promise<string[]> {
|
||||
const data = await api.get<HydraCollection<AuditLogEntityType>>('/audit-log-entity-types')
|
||||
return extractHydraMembers(data).map((entry) => entry.value)
|
||||
// `/audit-log-entity-types` is a single API Platform item resource
|
||||
// (not a hydra collection): it returns `{ entityTypes: string[] }`.
|
||||
const data = await api.get<AuditLogEntityTypes>('/audit-log-entity-types')
|
||||
return data.entityTypes ?? []
|
||||
}
|
||||
|
||||
return { list, entityTypes }
|
||||
|
||||
Reference in New Issue
Block a user