formated and linted

This commit is contained in:
Elmar Kresse
2023-10-17 21:16:58 +02:00
parent 4148b0c185
commit 10d0ae0d8a
23 changed files with 581 additions and 378 deletions

View File

@@ -19,14 +19,16 @@ export async function createIndividualFeed(modules: Module[]): Promise<string> {
return token;
}
export async function saveIndividualFeed(token: string, modules: Module[]): Promise<string> {
export async function saveIndividualFeed(
token: string,
modules: Module[],
): Promise<string> {
await fetch("/api/collections/feeds/records/" + token, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: "{\"modules\":" + JSON.stringify(modules) + "}",
body: '{"modules":' + JSON.stringify(modules) + "}",
})
.then((response) => {
return response.json();

View File

@@ -25,7 +25,16 @@ export async function fetchModulesByCourseAndSemester(
})
.then((modulesResponse) => {
modulesResponse.forEach((module: Module) =>
modules.push(new Module(module.name, course, module.name, module.prof, semester, module.events)),
modules.push(
new Module(
module.name,
course,
module.name,
module.prof,
semester,
module.events,
),
),
);
});
return modules;
@@ -39,7 +48,16 @@ export async function fetchAllModules(): Promise<Module[]> {
})
.then((responseModules: Module[]) => {
responseModules.forEach((module: Module) => {
modules.push(new Module(module.name, module.course, module.name, module.prof, module.semester, module.events));
modules.push(
new Module(
module.name,
module.course,
module.name,
module.prof,
module.semester,
module.events,
),
);
});
});

View File

@@ -1,6 +1,6 @@
import { Module } from "../model/module";
export async function fetchModule( name: string): Promise<Module> {
export async function fetchModule(name: string): Promise<Module> {
const request = new Request("/api/module", {
method: "GET",
headers: {
@@ -24,4 +24,4 @@ export async function fetchModule( name: string): Promise<Module> {
module.events,
),
);
}
}

View File

@@ -1,7 +1,7 @@
import { Module } from "../model/module";
import { Calendar } from "../model/calendar";
export async function getCalender( token: string): Promise<Module[]> {
export async function getCalender(token: string): Promise<Module[]> {
const request = new Request("/api/collections/feeds/records/" + token, {
method: "GET",
});
@@ -10,7 +10,5 @@ export async function getCalender( token: string): Promise<Module[]> {
.then((response) => {
return response.json();
})
.then(
(calendarResponse: Calendar) => calendarResponse.modules
);
}
.then((calendarResponse: Calendar) => calendarResponse.modules);
}