From a75b15d840003ec4938b528539a8e83bf4e3b8e1 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sun, 20 Oct 2019 21:23:29 -0400 Subject: [PATCH] [O] Separate findNextCourse() and nextCourse() --- src/components/navigation/navigation.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/navigation/navigation.ts b/src/components/navigation/navigation.ts index c14b98a..564a6ca 100644 --- a/src/components/navigation/navigation.ts +++ b/src/components/navigation/navigation.ts @@ -84,6 +84,12 @@ export default class Navigation extends Vue * @param indexOffset Index offset (Eg. 1 for next) */ public nextCourse(indexOffset: number) + { + // Set tab to the next index + this.updateIndex(CourseUtils.formatTabIndex(this.findNextCourse(indexOffset))) + } + + public findNextCourse(indexOffset: number) { // Find current course let courseId = this.activeIndex.split('/')[1]; @@ -92,13 +98,7 @@ export default class Navigation extends Vue let courseIndex = this.courses.findIndex(c => c.id == +courseId); // Find next course - let course = this.courses[courseIndex + indexOffset]; - - // Null case - if (course == null) return; - - // Set tab to the next index - this.updateIndex(CourseUtils.formatTabIndex(course)) + return this.courses[courseIndex + indexOffset]; } /**