Skip to content

Commit

Permalink
feat:ログアウト時に処理を行えるように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
KikyoNanakusa committed Mar 23, 2024
1 parent 8d6de37 commit a59d0aa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions typing-app/src/components/atoms/logoutButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,19 @@
'use client';

import Link from 'next/link';
import { useRouter } from 'next/router';
import { useRouter } from 'next/navigation';
import { Button } from "@chakra-ui/react";

const LogoutButton = () => {
const router = useRouter();

const handleLogout = async () => {
//TODO:ログアウト処理を実装
router.push('/login');
}

return (
<Button as={ Link } href="login" colorScheme="blue" size="lg">
<Button colorScheme="blue" size="lg" onClick={handleLogout}>
Logout
</Button>
);
Expand Down
2 changes: 1 addition & 1 deletion typing-app/src/components/organism/HomeMenuContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import LogoutButton from "../atoms/LogoutButton";
const HomeMenuContainer = () => {
return (
<Flex justify="center" align="center" h="65vh">
<VStack spacing = {8} align="stretch" maxWidth="md" mx="auto">
<VStack spacing = {8} align="stretch" width="50%" maxWidth="md" mx="auto">
<GameStartButton />
<RankingButton />
<LogoutButton />
Expand Down

0 comments on commit a59d0aa

Please sign in to comment.