Fixed pagination in audit log table

- the `created_at` key is stored directly under the object we fetch as
  the last event, rather than a subkey
- this meant we weren't checking the date of the last event correctly,
  which broke pagination
This commit is contained in:
Daniel Lockyer 2022-08-22 17:50:11 +02:00
parent e3e613de1c
commit 3831d8d479
No known key found for this signature in database
GPG Key ID: D21186F0B47295AD

View File

@ -47,12 +47,12 @@ export default class AuditLogEventFetcher extends Resource {
// NOTE: assumes data is always ordered by created_at desc
const lastEvent = this.data[this.data.length - 1];
if (!lastEvent?.data?.created_at) {
if (!lastEvent?.created_at) {
this.hasReachedEnd = true;
return;
}
const cursor = moment.utc(lastEvent.data.created_at).format('YYYY-MM-DD HH:mm:ss');
const cursor = moment.utc(lastEvent.created_at).format('YYYY-MM-DD HH:mm:ss');
if (cursor === this.cursor) {
this.hasReachedEnd = true;