Guest User

Untitled

a guest
Jan 9th, 2024
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. const YouTopic: React.FC = () => {
  2. const CHARACTER_LIMIT: number = 32;
  3. const ENDPOINT: string =
  4. "https://youtopic.vercel.app/api/generate_details";
  5. const [prompt, setPrompt] = React.useState("");
  6. const [title, setTitle] = React.useState("");
  7. const [description, setDesc] = React.useState("");
  8. const [hashtags, setHashtags] = React.useState([]);
  9. const [hasResult, setHasResult] = React.useState(false);
  10. const [isLoading, setIsLoading] = React.useState(false);
  11.  
  12. const onSubmit = () => {
  13. console.log("Submitting: " + prompt);
  14. setIsLoading(true);
  15. fetch(`${ENDPOINT}?prompt=${prompt}`)
  16. .then((res) => res.json())
  17. .then(onResult);
  18. };
Add Comment
Please, Sign In to add comment