...import { useSession } from "@/lib/auth";export function Sidebar({ className = "" }: SidebarProps) { const usesessionhook = useSession();console.log("session", usesessionhook);...
...import { useSession } from "@/lib/auth";export function Sidebar({ className = "" }: SidebarProps) { const usesessionhook = useSession();console.log("session", usesessionhook);...
I get this type error in VSCode
This expression is not callable. No constituent of type 'Atom<{ data: { user: { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; session: { id: string; createdAt: Date; ... 5 more ...; userAgent?: string | ... 1 more ... | undefined; }; } | null; error: BetterFetchError | null; isPendi...' is callable
This expression is not callable. No constituent of type 'Atom<{ data: { user: { id: string; name: string; email: string; emailVerified: boolean; createdAt: Date; updatedAt: Date; image?: string | null | undefined; }; session: { id: string; createdAt: Date; ... 5 more ...; userAgent?: string | ... 1 more ... | undefined; }; } | null; error: BetterFetchError | null; isPendi...' is callable
Not sure if this is relevant but if I run it anways i get a 404 on
http://localhost:3001/api/auth/use-session
http://localhost:3001/api/auth/use-session
in the network tab, I think its supposed to be calling get-session but i'm not sure why the hook from the library is doing this.
Solution
Okay I figured it out, useSession only works if your are using better auth and next as full stack not if you have your better auth backend on express and just using next as a front end.