udpate
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-08-27 09:50:32 +03:00
parent 3b628cbfb3
commit 83d2666f22
55 changed files with 560 additions and 486 deletions

View File

@@ -33,29 +33,29 @@ export default defineRouter(function (/* { store, ssrContext } */) {
history: createHistory(process.env.VUE_ROUTER_BASE)
})
const publicPath = ['404', 'terms', 'privacy', 'consent']
Router.beforeEach(async (to) => {
if (to.name !== 'telegram_only' && sessionStorage.getItem('isTelegram') === 'false') {
return { name: 'telegram_only', replace: true }
}
if (to.name === 'telegram_only') return true
const authStore = useAuthStore()
const projectsStore = useProjectsStore()
if (to.name === '404' || to.name === 'terms' || to.name === 'privacy' || to.name === 'consent') return true
if (to.name === 'login')
return authStore.isAuth ? { name: 'projects', replace: true } : true
if (to.name === 'login') return true
if (typeof to.name === 'string' && publicPath.includes(to.name)) return true
if (to.name === 'agreements' && authStore.isAuth) return true
if (to.name === 'agreements') return true
// if (!authStore.isTermsAccepted && authStore.isAuth) return { name: 'agreements' }
if (to.meta.guestOnly && authStore.isAuth) {
return { name: 'projects' }
}
if (to.meta.requiresAuth && !authStore.isAuth) {
return {
name: 'login',
replace: true
}
}
if (to.name === 'create_account' && !authStore.isAuth) return true
if (!authStore.isAuth) return { name: 'login', replace: true }
if (to.params.id) {
if (!projectsStore.isInit) await projectsStore.init()