fix: correct typing issue
parent
6bf5963b83
commit
c4dbdd05e0
|
@ -1,16 +1,17 @@
|
||||||
import {AxiosResponse} from "axios";
|
|
||||||
import {$axios} from "~/utils/api";
|
import {$axios} from "~/utils/api";
|
||||||
import {RestResponse} from "~/repositories/models/rest-response.model";
|
import {RestResponse} from "~/repositories/models/rest-response.model";
|
||||||
import {Question} from "~/repositories/models/question.model";
|
import {Question} from "~/repositories/models/question.model";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
findAllByAxeId(axeId: number) {
|
findAllByAxeId(axeId: number) {
|
||||||
return $axios.get<RestResponse<Question>>("/questions/search/byAxeId", {
|
return $axios
|
||||||
params: {
|
.get<RestResponse<Question>>("/questions/search/byAxeId", {
|
||||||
id: axeId
|
params: {
|
||||||
}
|
id: axeId
|
||||||
}).then((response: AxiosResponse<RestResponse<Question>>) => {
|
}
|
||||||
response.data._embedded.questions.map(question => {
|
})
|
||||||
|
.then((response) => {
|
||||||
|
response.data._embedded.questions.forEach(question => {
|
||||||
question.id = Number(question._links.self.href.replace($axios.defaults.baseURL + "/questions/", ""));
|
question.id = Number(question._links.self.href.replace($axios.defaults.baseURL + "/questions/", ""));
|
||||||
return question;
|
return question;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import {AxiosResponse} from "axios";
|
|
||||||
import {$axios} from "~/utils/api";
|
import {$axios} from "~/utils/api";
|
||||||
import {RestResponse} from "~/repositories/models/rest-response.model";
|
import {RestResponse} from "~/repositories/models/rest-response.model";
|
||||||
import {Quiz, Response, ResponseWithQuestion, Score} from "~/repositories/models/quiz.model";
|
import {Quiz, Response, ResponseWithQuestion, Score} from "~/repositories/models/quiz.model";
|
||||||
|
@ -11,7 +10,7 @@ export default {
|
||||||
sort: "createdDate,desc"
|
sort: "createdDate,desc"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((response: AxiosResponse<RestResponse<Quiz>>) => {
|
.then((response) => {
|
||||||
response.data._embedded.quizzes.map(quiz => {
|
response.data._embedded.quizzes.map(quiz => {
|
||||||
quiz.id = Number(quiz._links.self.href.replace($axios.defaults.baseURL + "/quizzes/", ""));
|
quiz.id = Number(quiz._links.self.href.replace($axios.defaults.baseURL + "/quizzes/", ""));
|
||||||
return quiz;
|
return quiz;
|
||||||
|
|
Loading…
Reference in New Issue