Show toast msg instead of silent error, when grid fetch fails
specifically, if a user clicks "Save defaults" for the grid filters, but they aren't currently logged in, error will ensue. this is a bit of an edge case which IIUC would require multiple tabs etc. but still is worth avoiding an error email from it.
This commit is contained in:
parent
aa500351ed
commit
cbbd77c49c
2 changed files with 48 additions and 24 deletions
|
@ -584,16 +584,28 @@
|
|||
|
||||
this.loading = true
|
||||
this.$http.get(`${'$'}{this.ajaxDataUrl}?${'$'}{params}`).then(({ data }) => {
|
||||
${grid.component_studly}CurrentData = data.data
|
||||
this.data = ${grid.component_studly}CurrentData
|
||||
this.rowStatusMap = data.row_status_map
|
||||
this.total = data.total_items
|
||||
this.firstItem = data.first_item
|
||||
this.lastItem = data.last_item
|
||||
this.loading = false
|
||||
this.checkedRows = this.locateCheckedRows(data.checked_rows)
|
||||
if (success) {
|
||||
success()
|
||||
if (!data.error) {
|
||||
${grid.component_studly}CurrentData = data.data
|
||||
this.data = ${grid.component_studly}CurrentData
|
||||
this.rowStatusMap = data.row_status_map
|
||||
this.total = data.total_items
|
||||
this.firstItem = data.first_item
|
||||
this.lastItem = data.last_item
|
||||
this.loading = false
|
||||
this.checkedRows = this.locateCheckedRows(data.checked_rows)
|
||||
if (success) {
|
||||
success()
|
||||
}
|
||||
} else {
|
||||
this.$buefy.toast.open({
|
||||
message: data.error,
|
||||
type: 'is-danger',
|
||||
duration: 2000, // 4 seconds
|
||||
})
|
||||
this.loading = false
|
||||
if (failure) {
|
||||
failure()
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue