Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031
  1. import { GetServerSideProps, NextPage } from 'next';
  2. import { Session } from 'next-auth';
  3. import { getSession, useSession } from 'next-auth/react';
  4. import ProfileCard from '../../components/cards/profile-card/ProfileCard';
  5. import { LOGIN_PAGE } from '../../constants/pages';
  6. interface IProp {
  7. session: Session;
  8. }
  9. const ProfilePage: NextPage<IProp> = (props) => {
  10. return <ProfileCard profileData={{ name: props.session.user!.name }} />;
  11. };
  12. export const getServerSideProps: GetServerSideProps = async (context) => {
  13. const session = await getSession({ req: context.req });
  14. if (!session) {
  15. return {
  16. redirect: {
  17. destination: LOGIN_PAGE,
  18. permanent: false,
  19. },
  20. };
  21. }
  22. return {
  23. props: { session },
  24. };
  25. };
  26. export default ProfilePage;