createServerFn
I need to set a session with the use of useSession to store a quizId, so that my quiz app can get the quiz from that cookie id. I'm using convex, with better-auth (and convex-better-auth).
So what's the Tanstack way of doing this:
- upon clicking a button to create a new quiz > use convex's useMutation to create the quiz > call serverFn to set the quizId in the cookie, OR
- upon clicking a button to create a new quiz > call serverFn (with useServerFn) to create the quiz, with using a new ConvexHttpClient and IN the serverFn and set the cookie with the created quizId.
With the last approach convex doesn't seem to get the headers with the better-auth JWT, so in the convex functions, it error Not authenticated...
Perhaps I'm anti-patterning here... both all these packages seem very client-oriented. 😕
1 Reply
absent-sapphire•2w ago
@ballingt