Use page specific stale-while-revalidate Cache-Control headers

This commit is contained in:
2022-09-20 00:20:18 +02:00
parent 39fc74d8e9
commit 5545871c85
12 changed files with 57 additions and 29 deletions

View File

@@ -4,7 +4,7 @@ import { fetchAPI } from '$utils/api'
import { PUBLIC_PREVIEW_COUNT } from '$env/static/public'
export const load: PageServerLoad = async ({ setHeaders }) => {
export const load: PageServerLoad = async () => {
try {
const res = await fetchAPI(`query {
locations: location (filter: { status: { _eq: "published" }}) {
@@ -87,8 +87,6 @@ export const load: PageServerLoad = async ({ setHeaders }) => {
}`)
if (res) {
setHeaders({ 'Cache-Control': 'public, max-age=1, stale-while-revalidate=59' })
const { data: { countPhotos, countLocations, countCountries, ...rest }} = res
return {