Skip to content

Commit

Permalink
ログアウトボタンをクライアントコンポーネントに変更し、ログアウト処理もクライアントコンポーネント用のロジックに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
KensukeOta committed May 21, 2024
1 parent a90d895 commit 0c91aa2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/components/atoms/LogoutButton/LogoutButton.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { signOut } from "@/auth";
"use client";

export const LogoutButton = async () => {
import { signOut } from "next-auth/react";

export const LogoutButton = () => {
return (
<form
action={async (formData) => {
"use server"
await signOut({ redirectTo: "/login" })
}}
className="inline-block"
<button
type="submit"
onClick={() => signOut({ callbackUrl: "/login" })}
className="inline-block w-full hover:bg-slate-200 hover:rounded-lg"
>
<button type="submit">ログアウト</button>
</form>
ログアウト
</button>
);
};

0 comments on commit 0c91aa2

Please sign in to comment.