| 12345678910111213141516171819202122232425262728 |
- import { getSession, useSession } from 'next-auth/react';
- import ProfileCard from '../../components/cards/profile-card/ProfileCard';
- import { LOGIN_PAGE } from '../../constants/pages';
-
- const ProfilePage = () => {
- const { data: session } = useSession();
-
- return <ProfileCard profileData={{ name: session.user.name }} />;
- };
-
- export async function getServerSideProps(context) {
- const session = await getSession({ req: context.req });
-
- if (!session) {
- return {
- redirect: {
- destination: LOGIN_PAGE,
- permanent: false,
- },
- };
- }
-
- return {
- props: { session },
- };
- }
-
- export default ProfilePage;
|