mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-07-09 23:18:07 +00:00
Refactor Dashboard
Took 1 hour 32 minutes
This commit is contained in:
+25
-3
@@ -1,13 +1,35 @@
|
||||
import {Text} from '@chakra-ui/react';
|
||||
import {useSession} from 'next-auth/react';
|
||||
import {useRouter} from 'next/router';
|
||||
import {Flex} from '@chakra-ui/react';
|
||||
|
||||
import type {Session} from '@/models/data_models/Session';
|
||||
import CardUser from "../components/layout/Dashboard/CardUser";
|
||||
import LeftPanel from "../components/layout/Dashboard/LeftPanel/LeftPanel";
|
||||
|
||||
export default function Dashboard() {
|
||||
const router = useRouter();
|
||||
const {data: session, status} = useSession();
|
||||
|
||||
if (status === "loading") return <Text>Loading...</Text>
|
||||
if (status === "unauthenticated") router.push("/login");
|
||||
|
||||
return (
|
||||
<Text>Dashboard de {session.user.firstName} {session.user.lastName}</Text>
|
||||
)
|
||||
|
||||
if (status === "authenticated") {
|
||||
const {user} = session as unknown as Session;
|
||||
|
||||
const refinedUser = {...user,
|
||||
age: 21,
|
||||
aPropos: "Je suis la personne fictive la plus fictive",
|
||||
images: ["135538.webp"],
|
||||
passions: ["Sport", "Voiture", "Cuisine"],
|
||||
};
|
||||
|
||||
return (
|
||||
<Flex gap={10}>
|
||||
<LeftPanel user={refinedUser} />
|
||||
<CardUser user={refinedUser} />
|
||||
</Flex>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user