import axios from "axios"; import clsx from "clsx"; import * as React from "react"; import { useForm } from "react-hook-form"; import { validEmail } from "utils/form-validation"; import Button from "@/components/button"; const GuestSession: React.VoidFunctionComponent = () => { const { handleSubmit, register, formState, getValues } = useForm<{ email: string; }>({ defaultValues: { email: "", }, }); return (

Guest session

Guest sessions allow us to remember your device so that you can edit your votes and comments later. However, these sessions are temporary and when they end, cannot be resumed.{" "} Read more about guest sessions.

Login with your email to make sure you don't lose access:

{formState.submitCount > 0 ? (
An email has been sent to {getValues("email")}. Please check your inbox.
) : (
{ axios.post("/api/login", { email }); })} > {formState.errors.email ? (
Please enter a valid email address
) : null}
)}
); }; export default GuestSession;