92 lines
1.7 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 = [{
2019-03-06 10:55:21 +05:30
name: 'home',
path: '',
component: Home
},
{
name: 'program',
path: '/Program/:program_name',
component: ProgramPage,
props: true
},
{
name: 'course',
path: '/Program/:program_name/:course_name/',
component: CoursePage,
props: true,
},
{
name: 'content',
path: '/Program/:program_name/:course_name/:topic/:type/:content',
component: ContentPage,
props: true,
beforeRouteUpdate (to, from, next) {
if (lms.store.checkProgramEnrollment(to.params.program_name)) {
2019-04-22 11:46:22 +05:30
next();
2019-03-06 10:55:21 +05:30
} else {
next({
name: 'program',
params: {
program_name: to.params.program_name
}
2019-04-22 11:46:22 +05:30
});
2018-11-24 20:31:35 +05:30
}
2019-03-06 10:55:21 +05:30
}
},
{
name: 'list',
path: '/List/:master',
component: ListPage,
props: true
},
{
name: 'signup',
path: '/Signup',
beforeEnter(to, from, next) {
2019-04-09 12:57:56 +05:30
window.location = window.location.origin.toString() + '/login#signup';
2018-11-24 20:31:35 +05:30
},
2019-03-06 10:55:21 +05:30
component: Home,
props: true
},
{
name: 'login',
path: '/Login',
beforeEnter(to, from, next) {
2019-04-09 12:57:56 +05:30
window.location = window.location.origin.toString() + '/login#login';
2018-12-10 18:35:27 +05:30
},
2019-03-06 10:55:21 +05:30
component: Home,
props: true
},
{
name: 'logout',
path: '/Logout',
beforeEnter(to, from, next) {
2019-04-09 12:57:56 +05:30
window.location = window.location.origin.toString() + '/?cmd=web_logout';
2018-12-10 18:35:27 +05:30
},
2019-03-06 10:55:21 +05:30
component: Home,
props: true
},
{
name: 'profile',
path: '/Profile',
component: ProfilePage,
props: true,
beforeEnter: (to, from, next) => {
if (!lms.store.checkLogin()) {
next({
name: 'home'
2019-04-09 12:57:56 +05:30
});
2019-03-06 10:55:21 +05:30
} else {
2019-04-09 12:57:56 +05:30
next();
2018-11-30 12:47:18 +05:30
}
2018-11-26 16:53:51 +05:30
}
2019-03-06 10:55:21 +05:30
}];
2018-11-09 11:47:09 +05:30
export default routes;