first commit

This commit is contained in:
sajjadtalkhabi
2026-05-13 01:43:05 +03:30
commit d2a577f254
297 changed files with 36274 additions and 0 deletions
@@ -0,0 +1,22 @@
import { useRoute, useRouter } from 'vue-router'
import { useAuthStore } from '@/store/auth'
export const useRedirectAfterLogin = () => {
const router = useRouter()
const route = useRoute()
const auth = useAuthStore()
return () => {
const redirect = route.query.redirect
if (redirect && typeof redirect === 'string') {
router.push(redirect).catch(() => router.push('/'))
return
}
const target =
auth.role === 'admin' ? { name: 'admin-dashboard' } : { name: 'student-dashboard' }
router.push(target).catch(() => router.push('/'))
}
}
export default useRedirectAfterLogin