-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add audit log detail page (#3356)
Co-authored-by: Matthew Elwell <matthew.elwell@flagsmith.com>
- Loading branch information
1 parent
16e6a28
commit e8bc7d3
Showing
22 changed files
with
1,807 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Res } from 'common/types/responses' | ||
import { Req } from 'common/types/requests' | ||
import { service } from 'common/service' | ||
|
||
export const auditLogItemService = service | ||
.enhanceEndpoints({ addTagTypes: ['AuditLogItem'] }) | ||
.injectEndpoints({ | ||
endpoints: (builder) => ({ | ||
getAuditLogItem: builder.query< | ||
Res['auditLogItem'], | ||
Req['getAuditLogItem'] | ||
>({ | ||
providesTags: (res) => [{ id: res?.id, type: 'AuditLogItem' }], | ||
query: (query: Req['getAuditLogItem']) => ({ | ||
url: `audit/${query.id}/`, | ||
}), | ||
}), | ||
// END OF ENDPOINTS | ||
}), | ||
}) | ||
|
||
export async function getAuditLogItem( | ||
store: any, | ||
data: Req['getAuditLogItem'], | ||
options?: Parameters< | ||
typeof auditLogItemService.endpoints.getAuditLogItem.initiate | ||
>[1], | ||
) { | ||
return store.dispatch( | ||
auditLogItemService.endpoints.getAuditLogItem.initiate(data, options), | ||
) | ||
} | ||
// END OF FUNCTION_EXPORTS | ||
|
||
export const { | ||
useGetAuditLogItemQuery, | ||
// END OF EXPORTS | ||
} = auditLogItemService | ||
|
||
/* Usage examples: | ||
const { data, isLoading } = useGetAuditLogItemQuery({ id: 2 }, {}) //get hook | ||
const [createAuditLogItem, { isLoading, data, isSuccess }] = useCreateAuditLogItemMutation() //create hook | ||
auditLogItemService.endpoints.getAuditLogItem.select({id: 2})(store.getState()) //access data from any function | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,5 +155,6 @@ export type Req = { | |
getGroupSummaries: { | ||
orgId: string | ||
} | ||
getAuditLogItem: { id: string } | ||
// END OF TYPES | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.