img => blog

This commit is contained in:
MeowcaTheoRange 2024-05-04 14:49:03 -05:00
parent 66d7c241d6
commit f96265c433
4 changed files with 7 additions and 7 deletions

View file

@ -35,16 +35,16 @@ export default async function Home({
status: string, status: string,
}[] }[]
} = JSON.parse(charblogs.data.body.replace(/[“”]/g, "\"")); } = JSON.parse(charblogs.data.body.replace(/[“”]/g, "\""));
const images = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${character.picture}`, { next: { revalidate: 3600 } }).then(x=>x.json()); const images = await fetch(`https://blog.abtmtr.link/api/collections/gallery/posts/${character.picture}`, { next: { revalidate: 3600 } }).then(x=>x.json());
let allPosts = []; let allPosts = [];
let currentPage = 1; let currentPage = 1;
const initReq = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts`, { next: { revalidate: 3600 } }).then(x=>x.json()); const initReq = await fetch(`https://blog.abtmtr.link/api/collections/gallery/posts`, { next: { revalidate: 3600 } }).then(x=>x.json());
const totalPosts:number = initReq.data.total_posts; const totalPosts:number = initReq.data.total_posts;
while (currentPage * 10 < totalPosts) { while (currentPage * 10 < totalPosts) {
const newPostList = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts?page=${currentPage}`, { next: { revalidate: 3600 } }).then(x=>x.json()); const newPostList = await fetch(`https://blog.abtmtr.link/api/collections/gallery/posts?page=${currentPage}`, { next: { revalidate: 3600 } }).then(x=>x.json());
allPosts.push(...newPostList.data.posts); allPosts.push(...newPostList.data.posts);
currentPage++; currentPage++;

View file

@ -36,7 +36,7 @@ export default async function Home({
status: string, status: string,
}[] }[]
}) => { }) => {
const charblogs = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${character.picture}`).then(x=>x.json()); const charblogs = await fetch(`https://blog.abtmtr.link/api/collections/gallery/posts/${character.picture}`).then(x=>x.json());
console.log(charblogs?.data?.images?.[0]); console.log(charblogs?.data?.images?.[0]);
return ( return (
<Link href={`/characters/${character.id}`} className={styles.CharacterContainerLink}> <Link href={`/characters/${character.id}`} className={styles.CharacterContainerLink}>

View file

@ -13,7 +13,7 @@ export default async function Home({
slug: string slug: string
} }
}) { }) {
const blog = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${params.slug}`, { cache: 'no-store' }).then(x=>x.json()); const blog = await fetch(`https://blog.abtmtr.link/api/collections/gallery/posts/${params.slug}`, { cache: 'no-store' }).then(x=>x.json());
if (blog.data == null) if (blog.data == null)
return notFound(); return notFound();
@ -54,7 +54,7 @@ export default async function Home({
<ConditionalNull condition={allCharacters.length >= 1}><h2>Characters</h2></ConditionalNull> <ConditionalNull condition={allCharacters.length >= 1}><h2>Characters</h2></ConditionalNull>
<div className={styles.ImageContainerGrid}> <div className={styles.ImageContainerGrid}>
{allCharacters.map(async (character) => { {allCharacters.map(async (character) => {
const charblogs = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${character.picture}`).then(x=>x.json()); const charblogs = await fetch(`https://blog.abtmtr.link/api/collections/gallery/posts/${character.picture}`).then(x=>x.json());
console.log(charblogs?.data?.images?.[0]); console.log(charblogs?.data?.images?.[0]);
return ( return (
<Link href={`/characters/${character.id}`} className={styles.ImageContainerLink}> <Link href={`/characters/${character.id}`} className={styles.ImageContainerLink}>

View file

@ -14,7 +14,7 @@ export default async function Home({
}) { }) {
const curPage = parseInt(searchParams?.page) || 1; const curPage = parseInt(searchParams?.page) || 1;
const blogs = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts?page=${curPage}`, { next: { revalidate: 3600 } }).then(x=>x.json()); const blogs = await fetch(`https://blog.abtmtr.link/api/collections/gallery/posts?page=${curPage}`, { next: { revalidate: 3600 } }).then(x=>x.json());
return ( return (
<MainLayout currentPage="/gallery/" title="Gallery" subtitle="via img.abtmtr.link"> <MainLayout currentPage="/gallery/" title="Gallery" subtitle="via img.abtmtr.link">
<img className="headerImage" src="/headers/gallery.png" alt="GALLERY"></img> <img className="headerImage" src="/headers/gallery.png" alt="GALLERY"></img>