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

30 lines
828 B
JavaScript

import { notify404 } from '@/utils/error'
/**
* This mixin can be used in combination with the component where the
* 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' })
})
}
}