93 lines
1.8 KiB
JavaScript
Raw Normal View History

2018-11-13 17:03:18 +05:30
import Home from "./pages/Home.vue";
import ProgramPage from "./pages/ProgramPage.vue";
2018-12-17 13:56:27 +05:30
import CoursePage from "./pages/CoursePage.vue";
2018-11-22 12:22:20 +05:30
import ContentPage from "./pages/ContentPage.vue";
import ListPage from "./pages/ListPage.vue";
2018-11-26 16:53:51 +05:30
import ProfilePage from "./pages/ProfilePage.vue";
2018-11-09 11:47:09 +05:30
2018-12-06 20:13:20 +05:30
const routes = [{
name: 'home',
path: '',
component: Home
},
{
name: 'program',
path: '/Program/:program_name',
component: ProgramPage,
props: true
},
2018-12-17 13:56:27 +05:30
{
name: 'course',
2019-02-26 16:47:10 +05:30
path: '/Program/:program_name/:course_name/',
2018-12-17 13:56:27 +05:30
component: CoursePage,
props: true,
},
2018-11-24 20:31:35 +05:30
{
name: 'content',
2018-12-17 13:56:27 +05:30
path: '/Program/:program_name/:course/:topic/:type/:content',
2018-11-24 20:31:35 +05:30
component: ContentPage,
props: true,
beforeEnter: (to, from, next) => {
2018-12-06 20:13:20 +05:30
if (lms.store.checkProgramEnrollment(this.program_name)) {
2018-11-26 11:59:12 +05:30
next()
2018-12-06 20:13:20 +05:30
} else {
next({
name: 'program',
params: {
program_name: to.params.program_name
}
})
2018-11-26 11:59:12 +05:30
}
2018-11-24 20:31:35 +05:30
}
},
{
name: 'list',
path: '/List/:master',
component: ListPage,
props: true
},
{
name: 'signup',
path: '/Signup',
beforeEnter(to, from, next) {
2018-12-06 20:13:20 +05:30
window.location = window.location.origin.toString() + '/login#signup'
},
component: Home,
props: true
},
2018-12-10 18:35:27 +05:30
{
name: 'login',
path: '/Login',
beforeEnter(to, from, next) {
window.location = window.location.origin.toString() + '/login#login'
},
component: Home,
props: true
},
{
name: 'logout',
path: '/Logout',
beforeEnter(to, from, next) {
window.location = window.location.origin.toString() + '/?cmd=web_logout'
},
component: Home,
props: true
},
2018-11-26 16:53:51 +05:30
{
name: 'profile',
path: '/Profile',
component: ProfilePage,
2018-11-30 12:47:18 +05:30
props: true,
beforeEnter: (to, from, next) => {
2018-12-06 20:13:20 +05:30
if (!lms.store.checkLogin()) {
next({
name: 'home'
})
} else {
2018-11-30 12:47:18 +05:30
next()
}
}
2018-11-26 16:53:51 +05:30
}
2018-11-09 11:47:09 +05:30
];
export default routes;