"use client" import React, { useState } from "react"; import { useRouter } from "next/navigation"; const FillEnvVariables = () => { const [neourl, setNeourl] = useState(''); const [neouser, setNeouser] = useState(''); const [neopass, setNeopass] = useState(''); const [openaikey, setOpenaiKey] = useState(''); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const router = useRouter(); const validateForm = () => { if (!neourl || !neouser || !neopass || !openaikey) { setError('All values are required'); return false; } setError(''); return true; }; const handleSubmit = async (event: { preventDefault: () => void; }) => { event.preventDefault(); if (!validateForm()) return; setLoading(true); localStorage.setItem('neourl', neourl); localStorage.setItem('neouser', neouser); localStorage.setItem('neopass', neopass); localStorage.setItem('openaikey', openaikey); setLoading(false); router.push('/chat') }; return (
logo SurfSense

Required Values

setNeourl(e.target.value)} name="neourl" id="neourl" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="name@company.com" />
setNeouser(e.target.value)} name="neouser" id="neouser" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="name@company.com" />
setNeopass(e.target.value)} name="neopass" id="neopass" placeholder="••••••••" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" />
setOpenaiKey(e.target.value)} name="openaikey" id="openaikey" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="name@company.com" />
{error &&

{error}

}
) } export default FillEnvVariables