Skip to content

Commit

Permalink
🔀 Merge #1927 into deploy/rinkeby
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Oct 31, 2024
2 parents 20406bb + fc299e5 commit acdad13
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/config/sitemap.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,24 @@ const getTopCreators = `${LIKECOIN_CHAIN_API}/likechain/likenft/v1/creator?ignor
const getTopCollectors = `${LIKECOIN_CHAIN_API}/likechain/likenft/v1/collector?ignore_list=${LIKECOIN_NFT_API_WALLET}`;
const getLatestBooks = `${LIKE_CO_API}/likernft/book/store/list`;
const getBookstoreProductsFromCMS = `${EXTERNAL_HOST}/api/bookstore/products`;
const getBookstoreCMSTags = `${EXTERNAL_HOST}/api/bookstore/tags`;

/* actual routes logic */
async function getSitemapRoutes() {
const [
newClassRes,
topClassRes,
creatorRes,
collectorRes,
newBookRes,
cmsBookRes,
] = await Promise.all(
[
getLatestNFTClasses,
getTopNFTClasses,
getTopCreators,
getTopCollectors,
getLatestBooks,
getBookstoreProductsFromCMS,
getBookstoreCMSTags,
].map(url =>
axios.get(url).catch(err => {
// eslint-disable-next-line no-console
Expand All @@ -69,13 +69,16 @@ async function getSitemapRoutes() {
id => `/nft/class/${id}`
);
const creator = ((creatorRes.data || {}).creators || []).map(c => c.account);
const collectors = ((collectorRes.data || {}).collectors || []).map(
c => c.account
);
const portfolioPageRoutes = [...new Set(creator.concat(collectors))].map(
id => `/${id}`
);
return nftDetailsPageRoutes.concat(portfolioPageRoutes).map(url => ({
const portfolioPageRoutes = creator.map(id => `/${id}`);

const tagIds = (cmsBookRes.data || {}.records || []).map(t => t.id);
const bookstorePageRoutes = tagIds.map(id => `/store?tag=${id}`);

let allRoutes = [];
allRoutes = allRoutes.concat(bookstorePageRoutes);
allRoutes = allRoutes.concat(nftDetailsPageRoutes);
allRoutes = allRoutes.concat(portfolioPageRoutes);
return allRoutes.map(url => ({
url: `/${locales[0]}${url}`,
links: locales.map(lang => ({ lang, url: `/${lang}${url}` })),
}));
Expand Down

0 comments on commit acdad13

Please sign in to comment.