owltide/composables/session.ts
Hornwitser d4cbbcbc2d Fix session being double requested
If the returned value of the fetched endpoint is blank that gets
converted to undefined, which confuses the request sharing between the
client and server causing the session to be requested on both sides.

Transform value to null if it's blank so that the session fetch is
de-duplicated.
2025-03-07 16:45:40 +01:00

6 lines
140 B
TypeScript

export const useAccountSession = () => useFetch(
"/api/auth/session",
{
transform: (input) => input === undefined ? null : input,
}
);