-
Notifications
You must be signed in to change notification settings - Fork 9
-
I was wondering why you are not using signOut
from @auth here. Is there something wrong with it?
"use client";
import type { CollectionSlug } from "payload";
export function SignOutButton({
userCollectionSlug = "users",
}: {
userCollectionSlug?: CollectionSlug;
}) {
return (
<button
type="button"
onClick={async () => {
await fetch(`/api/${userCollectionSlug}/logout`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
});
window.location.reload();
}}
>
Sign Out
</button>
);
}
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment