You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

13 lines
464 B

  1. export default async function({ app, store, route, redirect }) {
  2. try {
  3. await store.dispatch('projects/setCurrentProject', route.params.id)
  4. } catch(e) {
  5. redirect('/projects')
  6. }
  7. const role = store.getters['projects/getCurrentUserRole']
  8. const projectRoot = app.localePath('/projects/' + route.params.id)
  9. const path = route.fullPath.replace(/\/$/g, '')
  10. if (!role.is_project_admin && path !== projectRoot) {
  11. return redirect(projectRoot)
  12. }
  13. }