mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Add revalidate to static props
This commit is contained in:
parent
55c96dbb71
commit
c3a58ce424
1 changed files with 11 additions and 2 deletions
|
|
@ -22,11 +22,17 @@ export async function getStaticPaths() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ONE_MINUTE = 60
|
||||||
|
|
||||||
|
const defaultStaticProps = {
|
||||||
|
revalidate: ONE_MINUTE
|
||||||
|
}
|
||||||
|
|
||||||
export async function getStaticProps({ params }) {
|
export async function getStaticProps({ params }) {
|
||||||
const { slug } = params
|
const { slug } = params
|
||||||
|
|
||||||
// if (slug.length > 40 || !TWEET_ID.test(tweet)) {
|
// if (slug.length > 40 || !TWEET_ID.test(tweet)) {
|
||||||
// return { notFound: true };
|
// return { notFound: true, ...defaultStaticProps };
|
||||||
// }
|
// }
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -57,7 +63,10 @@ export async function getStaticProps({ params }) {
|
||||||
|
|
||||||
console.log('pageListing', pageListing)
|
console.log('pageListing', pageListing)
|
||||||
|
|
||||||
return pageListing ? { props: pageListing } : { notFound: true }
|
return pageListing ? {
|
||||||
|
props: pageListing,
|
||||||
|
...defaultStaticProps
|
||||||
|
} : { notFound: true }
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// The Twitter API most likely died
|
// The Twitter API most likely died
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue