Changeset 427732b in byjove


Ignore:
Timestamp:
07/26/2022 08:48:22 PM (6 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
3392f8c
Parents:
31cebd2
Message:

Detect 404 notfound when viewing CRUD record; warn user accordingly

and always redirect to model index page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/components/model-crud/ByjoveModelCrud.vue

    r31cebd2 r427732b  
    513513                }
    514514            }, response => {
    515                 if (response.status == 403) { // forbidden; redirect to model index
     515                if (response.status == 403) { // forbidden
    516516                    this.$buefy.toast.open({
    517517                        message: "You do not have permission to access that page.",
    518518                        type: 'is-danger',
    519519                    })
    520                     this.$router.push(this.getModelPathPrefix() + '/')
    521                 } else {
     520                } else if (response.status == 404) { // notfound
     521                    this.$buefy.toast.open({
     522                        message: `The requested ${this.getModelTitle()} was not found.`,
     523                        type: 'is-danger',
     524                    })
     525                } else { // other error
    522526                    this.$buefy.toast.open({
    523527                        message: "Failed to fetch page data!",
     
    525529                    })
    526530                }
     531                // redirect to model index
     532                this.$router.push(this.getIndexURL())
    527533            })
    528534
Note: See TracChangeset for help on using the changeset viewer.