diff --git a/src/api/admin/hintsAPI.js b/src/api/admin/hintsAPI.js new file mode 100644 index 0000000..cd969d5 --- /dev/null +++ b/src/api/admin/hintsAPI.js @@ -0,0 +1,17 @@ +import axiosInstance from "../axiosInstance.js"; + +export default { + async getHintStatus(hintId) { + return await axiosInstance({ + method: "get", + url: `/api/info/hint/${hintId}` + }); + }, + + async takeHint(hintId) { + return await axiosInstance({ + method: "post", + url: `/api/info/hint/${hintId}` + }); + } +}; diff --git a/src/api/axiosInstance.js b/src/api/axiosInstance.js index 7b6609d..2f4362b 100644 --- a/src/api/axiosInstance.js +++ b/src/api/axiosInstance.js @@ -32,6 +32,12 @@ axiosInstance.interceptors.response.use( "/auth/register", "/api/submit/challenge" ]; + + // For hint errors, pass through the error response + if (error.response && error.response.config.url.includes("/api/info/hint")) { + return Promise.reject(error); + } + if (!error.response) { router.push("/error/networkerror"); } else if (ignoreErrorPagesPath.includes(error.response.config.url)) { @@ -49,7 +55,6 @@ axiosInstance.interceptors.response.use( default: return error; } - Promise.reject(error); } } diff --git a/src/components/ChallCard.vue b/src/components/ChallCard.vue index 488c671..2432cac 100644 --- a/src/components/ChallCard.vue +++ b/src/components/ChallCard.vue @@ -16,6 +16,9 @@ | {{ challDetails.solves.length }} Solves + + | {{ challDetails.previous_tries }}/{{ challDetails.maxAttemptLimit }} attempts +
Hints Available
+ +Total
{{ details.challenges.length }}
+{{ getSolvedCount }}
Solved
{{ total - details.challenges.length }}
+{{ total - getSolvedCount }}
Unsolved