The session is always explicitly updated when it changes, cache it on the client if it has already been loaded.
9 lines
215 B
TypeScript
9 lines
215 B
TypeScript
export const useAccountSession = () => useFetch(
|
|
"/api/auth/session",
|
|
{
|
|
transform: (input) => input === undefined ? false : input,
|
|
getCachedData(key, nuxtApp) {
|
|
return nuxtApp.payload.data[key];
|
|
},
|
|
}
|
|
);
|