From f8ede7b2785688848e1b7a97cdd077f303677477 Mon Sep 17 00:00:00 2001 From: KikyoNanakusa Date: Fri, 5 Apr 2024 04:38:26 +0900 Subject: [PATCH 1/4] =?UTF-8?q?feat:=E3=83=AD=E3=82=B0=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E3=83=9C=E3=82=BF=E3=83=B3=E3=81=8B=E3=82=89logout?= =?UTF-8?q?=E3=82=92=E5=91=BC=E3=81=B3=E5=87=BA=E3=81=99=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typing-app/src/components/molecules/LogoutButton.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/typing-app/src/components/molecules/LogoutButton.tsx b/typing-app/src/components/molecules/LogoutButton.tsx index 336ba3e..d6b2845 100644 --- a/typing-app/src/components/molecules/LogoutButton.tsx +++ b/typing-app/src/components/molecules/LogoutButton.tsx @@ -1,16 +1,15 @@ "use client"; import React from "react"; -import { useRouter } from "next/navigation"; import { Button, useDisclosure } from "@chakra-ui/react"; -import LogoutModal from "./LogoutModal"; // 正しいパスに変更してください +import LogoutModal from "./LogoutModal"; +import { logout } from "@/app/actions"; const LogoutButton: React.FC = () => { const { isOpen, onOpen, onClose } = useDisclosure(); - const router = useRouter(); const handleLogout = async () => { - // TODO:ログアウト処理を実装 + await logout(); onOpen(); }; From 1c1e6857c65934854d29c8445f2651543b15274a Mon Sep 17 00:00:00 2001 From: KikyoNanakusa Date: Fri, 5 Apr 2024 06:21:37 +0900 Subject: [PATCH 2/4] =?UTF-8?q?feat:=E3=83=AD=E3=82=B0=E3=82=A2=E3=82=A6?= =?UTF-8?q?=E3=83=88=E6=99=82=E3=81=AE=E3=83=AA=E3=83=80=E3=82=A4=E3=83=AC?= =?UTF-8?q?=E3=82=AF=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typing-app/src/components/molecules/LogoutButton.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/typing-app/src/components/molecules/LogoutButton.tsx b/typing-app/src/components/molecules/LogoutButton.tsx index d6b2845..5283ce2 100644 --- a/typing-app/src/components/molecules/LogoutButton.tsx +++ b/typing-app/src/components/molecules/LogoutButton.tsx @@ -1,25 +1,33 @@ "use client"; import React from "react"; +import { useRouter } from "next/navigation"; import { Button, useDisclosure } from "@chakra-ui/react"; import LogoutModal from "./LogoutModal"; import { logout } from "@/app/actions"; const LogoutButton: React.FC = () => { const { isOpen, onOpen, onClose } = useDisclosure(); + const router = useRouter(); const handleLogout = async () => { await logout(); onOpen(); }; + //Note: ログアウト時にページをリレンダリングするためにリダイレクトする + const handleRedirect = () => { + onClose(); + router.push("/"); + } + return ( <> - + ); }; From f501f2fa893b52301fb38c81e51abe06e78c8b69 Mon Sep 17 00:00:00 2001 From: KikyoNanakusa Date: Fri, 5 Apr 2024 09:14:42 +0900 Subject: [PATCH 3/4] =?UTF-8?q?refactor:onClick=E3=81=AE=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E3=83=90=E3=83=83=E3=82=AF=E3=81=AE=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E3=82=92=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typing-app/src/components/molecules/LogoutButton.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/typing-app/src/components/molecules/LogoutButton.tsx b/typing-app/src/components/molecules/LogoutButton.tsx index 5283ce2..e24c281 100644 --- a/typing-app/src/components/molecules/LogoutButton.tsx +++ b/typing-app/src/components/molecules/LogoutButton.tsx @@ -3,7 +3,7 @@ import React from "react"; import { useRouter } from "next/navigation"; import { Button, useDisclosure } from "@chakra-ui/react"; -import LogoutModal from "./LogoutModal"; +import LogoutModal from "./LogoutModal"; import { logout } from "@/app/actions"; const LogoutButton: React.FC = () => { @@ -16,10 +16,10 @@ const LogoutButton: React.FC = () => { }; //Note: ログアウト時にページをリレンダリングするためにリダイレクトする - const handleRedirect = () => { + const pushToRoot = () => { onClose(); router.push("/"); - } + }; return ( <> @@ -27,7 +27,7 @@ const LogoutButton: React.FC = () => { Logout - + ); }; From 7c9ae8e0922391b3eeaf59a0f64a410e0620b4e5 Mon Sep 17 00:00:00 2001 From: KikyoNanakusa Date: Fri, 5 Apr 2024 09:16:48 +0900 Subject: [PATCH 4/4] =?UTF-8?q?refactor:=E5=91=BD=E5=90=8D=E3=82=92reLoad?= =?UTF-8?q?=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- typing-app/src/components/molecules/LogoutButton.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/typing-app/src/components/molecules/LogoutButton.tsx b/typing-app/src/components/molecules/LogoutButton.tsx index e24c281..730b9da 100644 --- a/typing-app/src/components/molecules/LogoutButton.tsx +++ b/typing-app/src/components/molecules/LogoutButton.tsx @@ -16,7 +16,7 @@ const LogoutButton: React.FC = () => { }; //Note: ログアウト時にページをリレンダリングするためにリダイレクトする - const pushToRoot = () => { + const reLoad = () => { onClose(); router.push("/"); }; @@ -27,7 +27,7 @@ const LogoutButton: React.FC = () => { Logout - + ); };