fix: correct typing issue

pull/1/head
Nicolas Doby 2022-10-10 10:46:32 +02:00
parent 6bf5963b83
commit c4dbdd05e0
2 changed files with 9 additions and 9 deletions

View File

@ -1,16 +1,17 @@
import {AxiosResponse} from "axios";
import {$axios} from "~/utils/api";
import {RestResponse} from "~/repositories/models/rest-response.model";
import {Question} from "~/repositories/models/question.model";
export default {
findAllByAxeId(axeId: number) {
return $axios.get<RestResponse<Question>>("/questions/search/byAxeId", {
params: {
id: axeId
}
}).then((response: AxiosResponse<RestResponse<Question>>) => {
response.data._embedded.questions.map(question => {
return $axios
.get<RestResponse<Question>>("/questions/search/byAxeId", {
params: {
id: axeId
}
})
.then((response) => {
response.data._embedded.questions.forEach(question => {
question.id = Number(question._links.self.href.replace($axios.defaults.baseURL + "/questions/", ""));
return question;
});

View File

@ -1,4 +1,3 @@
import {AxiosResponse} from "axios";
import {$axios} from "~/utils/api";
import {RestResponse} from "~/repositories/models/rest-response.model";
import {Quiz, Response, ResponseWithQuestion, Score} from "~/repositories/models/quiz.model";
@ -11,7 +10,7 @@ export default {
sort: "createdDate,desc"
}
})
.then((response: AxiosResponse<RestResponse<Quiz>>) => {
.then((response) => {
response.data._embedded.quizzes.map(quiz => {
quiz.id = Number(quiz._links.self.href.replace($axios.defaults.baseURL + "/quizzes/", ""));
return quiz;