1
0
Fork 0
mirror of https://gitlab.com/bramw/baserow.git synced 2025-04-13 08:41:46 +00:00
bramw_baserow/web-frontend/mixins/application.js

29 lines
813 B
JavaScript

import { notify404 } from '@/utils/error'
/**
* This mixin can be used in combination with the page an application routes to
* when selected. It will make sure that the application preSelect action is
* called so that the all the depending information is loaded. If something
* goes wrong while loading this information it will show a standard error.
*/
export default {
props: {
id: {
type: Number,
required: true
}
},
mounted() {
this.$store.dispatch('application/preSelect', this.id).catch(error => {
notify404(
this.$store.dispatch,
error,
'Application not found.',
"The application with the provided id doesn't exist or you " +
"don't have access to it."
)
this.$nuxt.$router.push({ name: 'app' })
})
}
}