2023-12-01 17:57:14 +00:00
|
|
|
import { useAuthStore } from '../stores/auth';
|
2022-09-20 19:59:52 +00:00
|
|
|
|
|
|
|
export default async (to, from, next) => {
|
2023-12-01 17:57:14 +00:00
|
|
|
const authStore = useAuthStore()
|
|
|
|
if (authStore.check && authStore.user?.workspaces_count === 0) {
|
2022-09-20 19:59:52 +00:00
|
|
|
if ([
|
|
|
|
'forms.create',
|
|
|
|
'forms.show',
|
|
|
|
'forms.edit',
|
|
|
|
'home'
|
|
|
|
].includes(to.name)
|
|
|
|
) {
|
|
|
|
next({ name: 'onboarding' })
|
2023-10-27 09:58:01 +00:00
|
|
|
return
|
2022-09-20 19:59:52 +00:00
|
|
|
}
|
2023-10-27 09:58:01 +00:00
|
|
|
}
|
2022-09-20 19:59:52 +00:00
|
|
|
|
|
|
|
next()
|
|
|
|
}
|