diff --git a/erpnext/public/js/education/lms/components/CourseCard.vue b/erpnext/public/js/education/lms/components/CourseCard.vue index 921ad9f7a0..e9b9e07f92 100644 --- a/erpnext/public/js/education/lms/components/CourseCard.vue +++ b/erpnext/public/js/education/lms/components/CourseCard.vue @@ -8,9 +8,10 @@ Course Content @@ -37,22 +38,17 @@ export default { name: "CourseCard", data() { return { + isLogin: lms.store.isLogin, courseMeta: {} } }, mounted() { - this.getCourseMeta().then(data => this.courseMeta = data) + if(this.isLogin) this.getCourseMeta().then(data => this.courseMeta = data) }, components: { AButton }, computed: { - showStart() { - return lms.loggedIn && !this.courseMeta.flag == "Complete"; - }, - showCompleted() { - return lms.loggedIn && this.courseMeta.flag == "Complete"; - }, firstContentRoute() { return `${this.program_name}/${this.course.name}/${this.courseMeta.content_type}/${this.courseMeta.content}` }, diff --git a/erpnext/public/js/education/lms/routes.js b/erpnext/public/js/education/lms/routes.js index 9346af719e..921f8ec40e 100644 --- a/erpnext/public/js/education/lms/routes.js +++ b/erpnext/public/js/education/lms/routes.js @@ -6,8 +6,21 @@ import ListPage from "./pages/ListPage.vue"; const routes = [ {name: 'home', path: '', component: Home}, {name: 'program', path: '/Program/:program_name', component: ProgramPage, props: true}, - {name: 'content', path: '/Program/:program_name/:course/:type/:content', component: ContentPage, props: true}, - {name: 'list', path: '/List/:master', component: ListPage, props: true}, + { + name: 'content', + path: '/Program/:program_name/:course/:type/:content', + component: ContentPage, + props: true, + beforeEnter: (to, from, next) => { + if(!lms.store.isLogin) next({name: 'home'}) + } + }, + { + name: 'list', + path: '/List/:master', + component: ListPage, + props: true + }, { name: 'signup', path: '/Signup',