import type { GetServerSidePropsContext } from "next"; import { signIn } from "next-auth/react"; import { useRef } from "react"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { Button, Meta, TextField } from "@calcom/ui"; import { getLayout } from "@components/auth/layouts/AdminLayout"; import { ssrInit } from "@server/lib/ssr"; function AdminView() { const { t } = useLocale(); const usernameRef = useRef(null); return ( <>
{ e.preventDefault(); const enteredUsername = usernameRef.current?.value.toLowerCase(); signIn("impersonation-auth", { username: enteredUsername }); }}>
{process.env.NEXT_PUBLIC_WEBSITE_URL}/} ref={usernameRef} hint={t("impersonate_user_tip")} defaultValue={undefined} />
); } AdminView.getLayout = getLayout; export const getServerSideProps = async (context: GetServerSidePropsContext) => { const ssr = await ssrInit(context); return { props: { trpcState: ssr.dehydrate(), }, }; }; export default AdminView;