Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/app/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ export const api = {
},
questions: {
get: (id: string): AxiosPromise<ApiTypes.IsaacQuestionPageDTO> => {
return endpoint.get(`/pages/questions/${id}`);
// URL-encode the ID to handle special characters like pipe '|' in question IDs
return endpoint.get(`/pages/questions/${encodeURIComponent(id)}`);
},
search: (query: QuestionSearchQuery): AxiosPromise<QuestionSearchResponse> => {
return endpoint.get(`/pages/questions/`, {
Expand All @@ -294,7 +295,9 @@ export const api = {
id: string,
answer: Immutable<ApiTypes.ChoiceDTO>,
): AxiosPromise<ApiTypes.QuestionValidationResponseDTO> => {
return endpoint.post(`/questions/${id}/answer`, answer);
// URL-encode the ID to handle special characters like pipe '|' in question IDs
const encodedId = encodeURIComponent(id);
return endpoint.post(`/questions/${encodedId}/answer`, answer);
},
answeredQuestionsByDate: (
userId: number | string,
Expand Down
Loading