boussole-pluss/frontend/repositories/questionRepository.ts

21 lines
686 B
TypeScript

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 => {
question.id = Number(question._links.self.href.replace($axios.defaults.baseURL + "/questions/", ""));
return question;
});
return response;
});
}
}