fix:#25 fixed router bug

This commit is contained in:
Elmar Kresse
2024-01-18 21:54:29 +01:00
parent 5102d3bea4
commit 6b695102d3
5 changed files with 67 additions and 35 deletions

View File

@@ -19,6 +19,23 @@ export async function createIndividualFeed(modules: Module[]): Promise<string> {
return token;
}
interface FeedResponse {
modules: FeedModule[];
collectionId: string;
collectionName: string;
id: string;
retrieved: string;
updated: string;
}
interface FeedModule {
course: string;
name: string;
reminder: boolean;
userDefinedName: string;
uuid: string;
}
export async function saveIndividualFeed(
token: string,
modules: Module[],
@@ -30,11 +47,14 @@ export async function saveIndividualFeed(
},
body: '{"modules":' + JSON.stringify(modules) + "}",
})
.then((response) => {
return response.json();
.then(async (response) => {
// parse response.json to FeedResponse
const feedResponse: FeedResponse = await response.json();
return feedResponse;
})
.then((response) => {
token = response;
.then((response: FeedResponse) => {
console.debug("response", response);
token = response.id;
});
return token;
}