perf(nuxt): re-enable caching

This commit is contained in:
parent 25a68b1f3e
commit 653d5c5f32
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -1,6 +1,5 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
import { IUser } from "~/models/user";
import { defineNuxtModule } from "@nuxt/kit";
// import speedkitHydrate from "nuxt-speedkit/dist/runtime/hydrate.mjs";
export type SessionData = IUser;
@ -10,7 +9,7 @@ const cac = {
cache: {
headersOnly: true,
// integrity: "",
// varies: ["Content-Length"],
varies: ["Content-Length", "Cookie"],
maxAge: 60,
},
swr: false,
@ -33,6 +32,7 @@ export default defineNuxtConfig({
"@pinia/nuxt",
"@vueuse/nuxt",
"nuxt-speedkit",
// "./modules/09.loaded",
],
speedkit: {
disableNuxtFontaine: true,
@ -56,7 +56,7 @@ export default defineNuxtConfig({
maxAgeInSeconds: 14 * 24 * 60 * 60,
// sameSiteAttribute: ,
},
sessionDataType: {} as { [Property in keyof IUser]: string },
sessionDataType: {} as IUser,
endpoints: {
signUp: { path: "/register", method: "post" },
signOut: { path: "/logout", method: "post" },
@ -81,18 +81,20 @@ export default defineNuxtConfig({
sourceMap: "inline",
},
},
preset: "node",
preset: "node-server",
},
routeRules: {
"/": cac,
"/api/**": { cors: true },
"/bands/**": cac,
"/band/**": cac,
"/authors": cac,
"/story/**": {
swr: true,
isr: true,
cache: {
maxAge: 1800,
headersOnly: true,
varies: ["Cookie", "Set-Cookie"],
},
},
// "/authors": { swr: 0 },