From 28975428233bbbc05c488015738b5d34d6ddb0d6 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 8 Mar 2025 00:34:46 +0100 Subject: [PATCH] Cache session data The session is always explicitly updated when it changes, cache it on the client if it has already been loaded. --- composables/session.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/composables/session.ts b/composables/session.ts index 1031183..18345cf 100644 --- a/composables/session.ts +++ b/composables/session.ts @@ -2,5 +2,8 @@ export const useAccountSession = () => useFetch( "/api/auth/session", { transform: (input) => input === undefined ? false : input, + getCachedData(key, nuxtApp) { + return nuxtApp.payload.data[key]; + }, } );