skip to Main Content

API Key Undefined in Axios – Reactjs

So I literally tried fetch and switch to axios to see what was wrong and still says my API key is undefined `import axios from "axios"; const apiKey = process.env.OPENAI_API_KEY; console.log(apiKey); axios .post( "https://api.openai.com/v1/chat/completions", { model: "gpt-3.5-turbo", messages: [{ role:…

VIEW QUESTION

How to create a dropdown menu using react js is this is a right to set a value after this how to approach this – Html

const [selectedDepartment, setSelectedDepartment] = useState(""); const DepartmentDropdown = () => { const handleSelectChange = (event) => { setSelectedDepartment(event.target.value); }; const handleSubmit = (e) => { e.preventDefault(); console.log(email); }; return( <div> <label htmlFor="departments">Select a Department:</label> <select id="departments" value={selectedDepartment} onChange={handleSelectChange} > <option…

VIEW QUESTION
Back To Top
Search