Fix pagination bug in model-crud

This commit is contained in:
Lance Edgar 2020-03-20 13:53:11 -05:00
parent 985860732d
commit 09852baa84

View file

@ -101,9 +101,7 @@
:total="rowData.total"
:current.sync="rowPage"
:per-page="rowsPerPage"
@change="changeRowPagination"
>
<!-- icon-pack="fas" -->
@change="changeRowPagination">
</b-pagination>
</div>
@ -445,20 +443,22 @@ export default {
}
this.$http.get(this.getApiRowsUrl(), {params: params}).then(response => {
this.rowData = response.data
// TODO: for some reason rowPage is getting reset to 0, maybe by
// the b-pagination component? for now this is our workaround
if (!this.rowPage) {
this.rowPage = 1
}
}, response => {
if (response.status == 403) { // forbidden; redirect to home page
this.$buefy.toast.open({
message: "You do not have permission to access that page.",
type: 'is-danger',
position: 'is-bottom',
})
this.$router.push('/')
} else {
this.$buefy.toast.open({
message: "Failed to fetch page data!",
type: 'is-danger',
position: 'is-bottom',
})
}
})