feat(frontend): Navigatie voor leerpad geïmplementeerd.
This commit is contained in:
parent
3c3fddb7d0
commit
07340de2e3
13 changed files with 216 additions and 54 deletions
|
@ -1,13 +1,23 @@
|
|||
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";
|
||||
|
||||
const searchLearningPathsEndpoint = new GetEndpoint<{}, {query: string}, LearningPathDTO[]>(
|
||||
"/learningObjects/:query"
|
||||
const learningPathEndpoint = new GetEndpoint<{}, {search?: string, hruid?: string, language?: Language}, LearningPathDTO[]>(
|
||||
"/learningPath"
|
||||
);
|
||||
|
||||
export function searchLearningPaths(query: string): RemoteResource<LearningPath[]> {
|
||||
return searchLearningPathsEndpoint
|
||||
.get({}, {query: query})
|
||||
return learningPathEndpoint
|
||||
.get({}, {search: query})
|
||||
.map(dtos => 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)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue