Files
classroomio/src/components/Course/function.js
T

33 lines
542 B
JavaScript
Raw Normal View History

2021-07-01 09:31:26 +03:00
const ROUTES = {
COURSES: 'courses',
LESSONS: 'lessons',
2021-07-01 09:31:26 +03:00
};
export function getNavItemRoute(courseId, routeId) {
const path = `/${ROUTES.COURSES}/${courseId}`;
if (!routeId) {
return path;
}
return `${path}/${routeId}`;
}
export function getLessonsRoute(courseId, lessonId) {
const path = getNavItemRoute(courseId, ROUTES.LESSONS);
2021-07-01 09:31:26 +03:00
if (!lessonId) {
2021-07-01 09:31:26 +03:00
return path;
}
return `${path}/${lessonId}`;
2021-07-01 09:31:26 +03:00
}
export function getLectureNo(index) {
if (index < 9) {
return `00${index}`;
}
return `0${index}`;
}