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)
|
this.fetchRows(uuid)
|
||||||
}
|
}
|
||||||
}, response => {
|
}, response => {
|
||||||
if (response.status == 403) { // forbidden; redirect to model index
|
if (response.status == 403) { // forbidden
|
||||||
this.$buefy.toast.open({
|
this.$buefy.toast.open({
|
||||||
message: "You do not have permission to access that page.",
|
message: "You do not have permission to access that page.",
|
||||||
type: 'is-danger',
|
type: 'is-danger',
|
||||||
})
|
})
|
||||||
this.$router.push(this.getModelPathPrefix() + '/')
|
} else if (response.status == 404) { // notfound
|
||||||
} else {
|
this.$buefy.toast.open({
|
||||||
|
message: `The requested ${this.getModelTitle()} was not found.`,
|
||||||
|
type: 'is-danger',
|
||||||
|
})
|
||||||
|
} else { // other error
|
||||||
this.$buefy.toast.open({
|
this.$buefy.toast.open({
|
||||||
message: "Failed to fetch page data!",
|
message: "Failed to fetch page data!",
|
||||||
type: 'is-danger',
|
type: 'is-danger',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// redirect to model index
|
||||||
|
this.$router.push(this.getIndexURL())
|
||||||
})
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue