Fix: handle page out of range in mgmt lists after delete (#8771)

This commit is contained in:
shamoon
2025-01-16 00:59:27 -08:00
committed by GitHub
parent f68ee628d9
commit 283bcb4c91
3 changed files with 50 additions and 22 deletions

View File

@@ -1,3 +1,4 @@
import { HttpErrorResponse } from '@angular/common/http'
import {
Directive,
OnDestroy,
@@ -152,9 +153,17 @@ export abstract class ManagementListComponent<T extends ObjectWithId>
}),
delay(100)
)
.subscribe(() => {
this.show = true
this.loading = false
.subscribe({
error: (error: HttpErrorResponse) => {
if (error.error?.detail?.includes('Invalid page')) {
this.page = 1
this.reloadData()
}
},
next: () => {
this.show = true
this.loading = false
},
})
}