@@ -62,6 +62,45 @@ class _Config { } } // eslint-disable-next-line valid-jsdoc /** * fetch problem title, level via solved.ac api * @see {@link https://solvedac.github.io/unofficial-documentation/#/operations/getProblemByIdArray} * @param {string[]} pids - list of problem id (up to 100) * @param { ({ problemId, titleKo, level }) => void } callback */ function fetchProblemsFromSolvedAc(pids, callback) { const query = encodeURIComponent(pids.join(',')); console.log(`https://solved.ac/api/v3/problem/lookup?problemIds=${query}`); fetch(`https://solved.ac/api/v3/problem/lookup?problemIds=${query}`) .then((res) => { console.log('fetchProblemsFromSolvedAc', res); return res; }) .then((res) => res.json()) .then(callback) .catch(() => callback(null)); }
fardhin78 opened this issue · 0 comments
fardhin78 commented
@@ -62,6 +62,45 @@ class _Config {
}
}
// eslint-disable-next-line valid-jsdoc
/**
* fetch problem title, level via solved.ac api
* @see {@link https://solvedac.github.io/unofficial-documentation/#/operations/getProblemByIdArray}
* @param {string[]} pids - list of problem id (up to 100)
* @param { ({ problemId, titleKo, level }) => void } callback
*/
function fetchProblemsFromSolvedAc(pids, callback) {
const query = encodeURIComponent(pids.join(','));
console.log(`https://solved.ac/api/v3/problem/lookup?problemIds=${query}`);
fetch(`https://solved.ac/api/v3/problem/lookup?problemIds=${query}`)
.then((res) => {
console.log('fetchProblemsFromSolvedAc', res);
return res;
})
.then((res) => res.json())
.then(callback)
.catch(() => callback(null));
}