mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-05-13 17:21:53 +00:00
refactor: Chat
Took 2 minutes
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
import {Button, Text} from '@chakra-ui/react';
|
||||
import {Button} from '@chakra-ui/react';
|
||||
import {useSession} from 'next-auth/react';
|
||||
import {useRouter} from 'next/router';
|
||||
|
||||
export default function Chat() {
|
||||
const router = useRouter();
|
||||
const {data: session, status} = useSession()
|
||||
const {data: session, status} = useSession();
|
||||
|
||||
if (session)
|
||||
return (
|
||||
<>
|
||||
{
|
||||
session.user.ChatID.map((id: string, index: number) => <Button key={index} onClick={() => router.push(`/chat/${id}`)} >{id}</Button>)
|
||||
}
|
||||
</>
|
||||
)
|
||||
return (
|
||||
<>
|
||||
{session.user.ChatID.map(
|
||||
(id: string, index: number) => (
|
||||
<Button key={index} onClick={() =>
|
||||
router.push(`/chat/${id}`)}>{id}</Button>
|
||||
),
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user