superMrToast
TTCTheo's Typesafe Cult
•Created by superMrToast on 9/23/2024 in #questions
Signing Out from client side - not removing session from DB
I'm using the create-t3-turbo mono repo
When I use the server side sign in/out button I can see the session is correctly removed from the DB, yay!
When I try and create a client side button to signOut it doesn't remove the session from the db, sad 😦
I have this code
"use client";
import { api } from "~/trpc/react";
export function SignOutButton() {
const signOut = api.auth.signOut.useMutation();
return (
<button onClick={() => signOut.mutate()}>
sign out
</button>
);
}
I get a response back, signOut.status is 'success' but the session stays in the DB
What is different about calling the signOut function from the client that I don't understand?
Many thanks in advance to anyone who looks over this and understands
3 replies