import type { GetServerSideProps, NextPage } from "next"; import Head from "next/head"; import { useSession } from "next-auth/react"; import RoomList from "~/components/RoomList"; import { useState } from "react"; import Link from "next/link"; import { FaShieldAlt } from "react-icons/fa"; import { getServerAuthSession } from "~/server/auth"; export const getServerSideProps: GetServerSideProps = async (ctx) => { const session = await getServerAuthSession(ctx); // Redirect to login if not signed in if (!session) { return { redirect: { destination: `/api/auth/signin?callbackUrl=${ctx.resolvedUrl}`, permanent: false, }, }; } // Return session if logged in return { props: { session }, }; }; const Home: NextPage = () => { return ( <>