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.
This commit is contained in:
Hornwitser 2025-03-07 16:45:40 +01:00
parent b2a5b67096
commit d4cbbcbc2d

View file

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