mirror of
https://github.com/vega-org/vega-providers.git
synced 2026-04-17 23:51:44 +00:00
fix: refactor episode retrieval to support pagination and sort episodes by title
This commit is contained in:
@@ -34,7 +34,6 @@ export const getEpisodes = async function ({
|
||||
},
|
||||
});
|
||||
const data = res.data;
|
||||
console.log("nfEpisodes", data);
|
||||
|
||||
data?.episodes?.map((episode: any) => {
|
||||
episodeList.push({
|
||||
@@ -49,7 +48,11 @@ export const getEpisodes = async function ({
|
||||
}
|
||||
}
|
||||
|
||||
return episodeList;
|
||||
return episodeList.sort((a, b) => {
|
||||
const aNum = parseInt(a.title.replace("Episode ", ""));
|
||||
const bNum = parseInt(b.title.replace("Episode ", ""));
|
||||
return aNum - bNum;
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("nfGetEpisodes error", err);
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user