feat(frontend): Functionaliteit om leerobjecten te tonen toegevoegd.
Hiervoor ook de state management geherstructureerd.
This commit is contained in:
parent
07340de2e3
commit
728b04c9d8
12 changed files with 141 additions and 150 deletions
|
@ -1,6 +1,5 @@
|
|||
import {GetEndpoint} from "@/services/api-client/endpoints/get-endpoint.ts";
|
||||
import {LearningPath, type LearningPathDTO} from "@/services/learning-content/learning-path.ts";
|
||||
import type {RemoteResource} from "@/services/api-client/remote-resource.ts";
|
||||
import type {Language} from "@/services/learning-content/language.ts";
|
||||
import {single} from "@/utils/response-assertions.ts";
|
||||
|
||||
|
@ -8,16 +7,12 @@ const learningPathEndpoint = new GetEndpoint<{}, {search?: string, hruid?: strin
|
|||
"/learningPath"
|
||||
);
|
||||
|
||||
export function searchLearningPaths(query: string): RemoteResource<LearningPath[]> {
|
||||
return learningPathEndpoint
|
||||
.get({}, {search: query})
|
||||
.map(dtos => dtos.map(dto => LearningPath.fromDTO(dto)));
|
||||
export async function searchLearningPaths(query: string): Promise<LearningPath[]> {
|
||||
let dtos = await learningPathEndpoint.get({}, {search: query})
|
||||
return dtos.map(dto => LearningPath.fromDTO(dto));
|
||||
}
|
||||
|
||||
export function getLearningPath(hruid: string, language: Language): RemoteResource<LearningPath> {
|
||||
console.log({hruid, language})
|
||||
return learningPathEndpoint
|
||||
.get({}, {hruid, language})
|
||||
.map(it => {console.log(it); return it;})
|
||||
.map(dtos => LearningPath.fromDTO(single(dtos)));
|
||||
export async function getLearningPath(hruid: string, language: Language): Promise<LearningPath> {
|
||||
let dtos = await learningPathEndpoint.get({}, {hruid, language});
|
||||
return LearningPath.fromDTO(single(dtos));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue