configure caching rules
This commit is contained in:
parent
44f350d393
commit
cc6e9a336f
7 changed files with 10 additions and 10 deletions
|
@ -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 (
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 (
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue