From 0b4005743eb64a18460d5241dbd2b1b501f4e2ea Mon Sep 17 00:00:00 2001 From: "./raj" Date: Thu, 20 Mar 2025 02:00:11 +0530 Subject: [PATCH] fix: /site caching, closes https://github.com/Xyphyn/photon/issues/508 (#509) --- src/lib/lemmy.svelte.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/lemmy.svelte.ts b/src/lib/lemmy.svelte.ts index 0345d07d..260bb992 100644 --- a/src/lib/lemmy.svelte.ts +++ b/src/lib/lemmy.svelte.ts @@ -36,12 +36,17 @@ async function customFetch( ): Promise { const f = func ? func : fetch - if (init) + if (init) { init.headers = { ...init.headers, ...(auth ? { authorization: `Bearer ${auth}` } : {}), } + if (auth) { + init.cache = 'no-store' + } + } + if (init?.body && auth) { try { const json = JSON.parse(init.body.toString())