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
405 B

  1. import { NuxtAppOptions } from '@nuxt/types'
  2. import _ from 'lodash'
  3. export default _.debounce(async ({ app, route, redirect }: NuxtAppOptions) => {
  4. const project = app.store.getters['projects/currentProject']
  5. if (project.id !== route.params.id) {
  6. try {
  7. await app.store.dispatch('projects/setCurrentProject', route.params.id)
  8. } catch (e) {
  9. redirect('/projects')
  10. }
  11. }
  12. }, 1000)