configure caching rules

This commit is contained in:
MeowcaTheoRange 2024-04-02 18:00:34 -05:00
parent 44f350d393
commit cc6e9a336f
7 changed files with 10 additions and 10 deletions

View file

@ -10,7 +10,7 @@ export default async function Home({
slug: string
}
}) {
const blog = await fetch(`https://blog.abtmtr.link/api/collections/mtr/posts/${params.slug}`).then(x=>x.json());
const blog = await fetch(`https://blog.abtmtr.link/api/collections/mtr/posts/${params.slug}`, { cache: 'no-store' }).then(x=>x.json());
if (blog.data == null)
return notFound();
return (

View file

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

View file

@ -14,7 +14,7 @@ export default async function Home({
slug: string
}
}) {
const charblogs = await fetch(`https://blog.abtmtr.link/api/collections/characters/posts/${params.slug}`).then(x=>x.json());
const charblogs = await fetch(`https://blog.abtmtr.link/api/collections/characters/posts/${params.slug}`, { cache: 'no-store' }).then(x=>x.json());
if (charblogs.data == null) return notFound();
@ -35,16 +35,16 @@ export default async function Home({
status: string,
}[]
} = 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());
const images = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${character.picture}`, { next: { revalidate: 3600 } }).then(x=>x.json());
let allPosts = [];
let currentPage = 1;
const initReq = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts`).then(x=>x.json());
const initReq = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts`, { next: { revalidate: 3600 } }).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());
const newPostList = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts?page=${currentPage}`, { next: { revalidate: 3600 } }).then(x=>x.json());
allPosts.push(...newPostList.data.posts);
currentPage++;

View file

@ -10,7 +10,7 @@ export default async function Home({
slug: string
}
}) {
const blog = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${params.slug}`).then(x=>x.json());
const blog = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${params.slug}`, { cache: 'no-store' }).then(x=>x.json());
if (blog.data == null)
return notFound();
return (

View file

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

View file

@ -10,7 +10,7 @@ export default async function Home({
slug: string
}
}) {
const blog = await fetch(`https://blog.abtmtr.link/api/collections/stories/posts/${params.slug}`).then(x=>x.json());
const blog = await fetch(`https://blog.abtmtr.link/api/collections/stories/posts/${params.slug}`, { cache: 'no-store' }).then(x=>x.json());
if (blog.data == null)
return notFound();
return (

View file

@ -12,7 +12,7 @@ export default async function Home({
}
}) {
const curPage = parseInt(searchParams?.page) || 1;
const blogs = await fetch(`https://blog.abtmtr.link/api/collections/stories/posts?page=${curPage}`).then(x=>x.json());
const blogs = await fetch(`https://blog.abtmtr.link/api/collections/stories/posts?page=${curPage}`, { cache: 'no-store' }).then(x=>x.json());
return (
<MainLayout currentPage="/stories/" title="Stories" subtitle="via blog.abtmtr.link">
<img className="headerImage" src="/headers/stories.png" alt="STORIES"></img>