Detect 404 notfound when viewing CRUD record; warn user accordingly
and always redirect to model index page
This commit is contained in:
parent
31cebd28c2
commit
427732bf1a
|
@ -512,18 +512,24 @@ export default {
|
|||
this.fetchRows(uuid)
|
||||
}
|
||||
}, response => {
|
||||
if (response.status == 403) { // forbidden; redirect to model index
|
||||
if (response.status == 403) { // forbidden
|
||||
this.$buefy.toast.open({
|
||||
message: "You do not have permission to access that page.",
|
||||
type: 'is-danger',
|
||||
})
|
||||
this.$router.push(this.getModelPathPrefix() + '/')
|
||||
} else {
|
||||
} else if (response.status == 404) { // notfound
|
||||
this.$buefy.toast.open({
|
||||
message: `The requested ${this.getModelTitle()} was not found.`,
|
||||
type: 'is-danger',
|
||||
})
|
||||
} else { // other error
|
||||
this.$buefy.toast.open({
|
||||
message: "Failed to fetch page data!",
|
||||
type: 'is-danger',
|
||||
})
|
||||
}
|
||||
// redirect to model index
|
||||
this.$router.push(this.getIndexURL())
|
||||
})
|
||||
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue