RELEASE THE REQSPAMMER

This commit is contained in:
MeowcaTheoRange 2024-04-02 12:55:38 -05:00
parent 745bba3c08
commit bd8c548978

View file

@ -37,21 +37,20 @@ export default async function Home({
} = JSON.parse(charblogs.data.body.replace(/[“”]/g, "\""));
const images = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${character.picture}`).then(x=>x.json());
// // REQSPAMMER
// let allPosts = [];
// let currentPage = 1;
let allPosts = [];
let currentPage = 1;
// const initReq = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts`).then(x=>x.json());
// const totalPosts:number = initReq.data.total_posts;
const initReq = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts`).then(x=>x.json());
const totalPosts:number = initReq.data.total_posts;
// while (currentPage * 10 < totalPosts) {
// const newPostList = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts?page=${currentPage}`).then(x=>x.json());
// allPosts.push(...newPostList.data.posts);
while (currentPage * 10 < totalPosts) {
const newPostList = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts?page=${currentPage}`).then(x=>x.json());
allPosts.push(...newPostList.data.posts);
// currentPage++;
// }
currentPage++;
}
// const myPosts = allPosts.filter(post => post.tags?.includes(character.id));
const myPosts = allPosts.filter(post => post.tags?.includes(character.id));
return (
<MainLayout currentPage="/characters/" title="Characters" backButton>
@ -69,8 +68,7 @@ export default async function Home({
</ConditionalNull>
</div>
<h2>Gallery</h2>
<p><i>Feature coming soon...</i></p>
{/* <div className={styles.CharacterContainerGrid}>
<div className={styles.CharacterContainerGrid}>
{myPosts.map(async (img:{
slug: string,
title: string,
@ -88,7 +86,7 @@ export default async function Home({
</Link>
);
})}
</div> */}
</div>
</MainLayout>
)
}