fix:#26 lint and format

This commit is contained in:
Elmar Kresse
2024-02-02 00:27:48 +01:00
parent 25a7464e41
commit 5b45621ed1
2 changed files with 10 additions and 7 deletions

View File

@@ -20,7 +20,9 @@ export async function fetchCourse(): Promise<string[]> {
return courses; return courses;
} }
export async function fetchCourseBySemester(semester: string): Promise<string[]> { export async function fetchCourseBySemester(
semester: string,
): Promise<string[]> {
const courses: string[] = []; const courses: string[] = [];
await fetch("/api/courses?semester=" + semester) await fetch("/api/courses?semester=" + semester)
.then((response) => { .then((response) => {

View File

@@ -1,7 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import { computed, ComputedRef, Ref, ref, watch } from "vue"; import { computed, ComputedRef, Ref, ref, watch } from "vue";
import { fetchCourseBySemester, import {
fetchModulesByCourseAndSemester fetchCourseBySemester,
fetchModulesByCourseAndSemester,
} from "../api/fetchCourse"; } from "../api/fetchCourse";
import DynamicPage from "./DynamicPage.vue"; import DynamicPage from "./DynamicPage.vue";
import ModuleSelection from "../components/ModuleSelection.vue"; import ModuleSelection from "../components/ModuleSelection.vue";
@@ -18,7 +19,9 @@ async function getModules() {
} }
async function getCourses() { async function getCourses() {
courses.value = await fetchCourseBySemester(selectedSemester.value.value).then((data) => { courses.value = await fetchCourseBySemester(
selectedSemester.value.value,
).then((data) => {
return data.map((course) => { return data.map((course) => {
return { name: course }; return { name: course };
}); });
@@ -29,7 +32,7 @@ const store = moduleStore();
const { t } = useI18n({ useScope: "global" }); const { t } = useI18n({ useScope: "global" });
const selectedCourse: Ref<{ name: string }> = ref({ name: "" }); const selectedCourse: Ref<{ name: string }> = ref({ name: "" });
const courses: Ref<{ name: string; }[]> = ref([]); const courses: Ref<{ name: string }[]> = ref([]);
const modules: Ref<Module[]> = ref([]); const modules: Ref<Module[]> = ref([]);
const semesters: ComputedRef<{ name: string; value: string }[]> = computed( const semesters: ComputedRef<{ name: string; value: string }[]> = computed(
@@ -53,8 +56,6 @@ watch(
// init the courses dropdown with the first semester that is default selected // init the courses dropdown with the first semester that is default selected
getCourses(); getCourses();
</script> </script>
<template> <template>