Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const YouTopic: React.FC = () => {
- const CHARACTER_LIMIT: number = 32;
- const ENDPOINT: string =
- "https://youtopic.vercel.app/api/generate_details";
- const [prompt, setPrompt] = React.useState("");
- const [title, setTitle] = React.useState("");
- const [description, setDesc] = React.useState("");
- const [hashtags, setHashtags] = React.useState([]);
- const [hasResult, setHasResult] = React.useState(false);
- const [isLoading, setIsLoading] = React.useState(false);
- const onSubmit = () => {
- console.log("Submitting: " + prompt);
- setIsLoading(true);
- fetch(`${ENDPOINT}?prompt=${prompt}`)
- .then((res) => res.json())
- .then(onResult);
- };
Add Comment
Please, Sign In to add comment