opnform/resources/js/middleware/notion-connection.js

20 lines
380 B
JavaScript
Raw Normal View History

import { useAuthStore } from '../stores/auth';
2022-09-20 19:59:52 +00:00
export default async (to, from, next) => {
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()
}