mirror of https://github.com/doccano/doccano.git
pythondatasetsactive-learningtext-annotationdatasetnatural-language-processingdata-labelingmachine-learningannotation-tool
13 lines
463 B
13 lines
463 B
import { NuxtAppOptions } from '@nuxt/types'
|
|
|
|
export default async ({ app, route, redirect }: NuxtAppOptions) => {
|
|
const project = app.store.getters['projects/currentProject']
|
|
const isNotSet = Object.keys(project).length === 0 && project.constructor === Object
|
|
if (isNotSet || project.id !== route.params.id) {
|
|
try {
|
|
await app.store.dispatch('projects/setCurrentProject', route.params.id)
|
|
} catch (e) {
|
|
redirect('/projects')
|
|
}
|
|
}
|
|
}
|