mirror of https://github.com/doccano/doccano.git
9 changed files with 40 additions and 45 deletions
Unified View
Diff Options
-
8frontend/middleware/setCurrentProject.ts
-
8frontend/pages/projects/_id/comments/index.vue
-
7frontend/pages/projects/_id/dataset/_example_id/edit.vue
-
10frontend/pages/projects/_id/dataset/index.vue
-
7frontend/pages/projects/_id/labels/_label_id/edit.vue
-
7frontend/pages/projects/_id/labels/add.vue
-
8frontend/pages/projects/_id/labels/import.vue
-
25frontend/pages/projects/_id/labels/index.vue
-
5frontend/pages/projects/_id/metrics/index.vue
@ -1,13 +1,13 @@ |
|||||
import { NuxtAppOptions } from '@nuxt/types' |
import { NuxtAppOptions } from '@nuxt/types' |
||||
|
import _ from 'lodash' |
||||
|
|
||||
export default async ({ app, route, redirect }: NuxtAppOptions) => { |
|
||||
|
export default _.debounce(async ({ app, route, redirect }: NuxtAppOptions) => { |
||||
const project = app.store.getters['projects/currentProject'] |
const project = app.store.getters['projects/currentProject'] |
||||
const isNotSet = Object.keys(project).length === 0 && project.constructor === Object |
|
||||
if (isNotSet || project.id !== route.params.id) { |
|
||||
|
if (project.id !== route.params.id) { |
||||
try { |
try { |
||||
await app.store.dispatch('projects/setCurrentProject', route.params.id) |
await app.store.dispatch('projects/setCurrentProject', route.params.id) |
||||
} catch (e) { |
} catch (e) { |
||||
redirect('/projects') |
redirect('/projects') |
||||
} |
} |
||||
} |
} |
||||
} |
|
||||
|
}, 1000) |
Write
Preview
Loading…
Cancel
Save