Updated the MatchSentences exercise to work better now
This commit is contained in:
@@ -29,14 +29,14 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
|
||||
module: Module;
|
||||
endpoint: string;
|
||||
topic?: string;
|
||||
exercises?: string[];
|
||||
exercises?: string[] | string;
|
||||
difficulty?: Difficulty;
|
||||
};
|
||||
const url = `${process.env.BACKEND_URL}/${endpoint}`;
|
||||
|
||||
const params = new URLSearchParams();
|
||||
if (topic) params.append("topic", topic);
|
||||
if (exercises) exercises.forEach((exercise) => params.append("exercises", exercise));
|
||||
if (exercises) (typeof exercises === "string" ? [exercises] : exercises).forEach((exercise) => params.append("exercises", exercise));
|
||||
if (difficulty) params.append("difficulty", difficulty);
|
||||
|
||||
const result = await axios.get(`${url}${params.toString().length > 0 ? `?${params.toString()}` : ""}`, {
|
||||
|
||||
Reference in New Issue
Block a user