import SettingsGroup from "@components/settings-group" import { Button, Input, Spacer, Textarea, useToasts } from "@geist-ui/core" import { useEffect, useState } from "react" import { adminFetcher } from "." const Homepage = () => { const [description, setDescription] = useState("") const [title, setTitle] = useState("") const { setToast } = useToasts() useEffect(() => { const fetchServerInfo = async () => { const res = await adminFetcher("/server-info") const data = await res.json() setDescription(data.welcomeMessage) setTitle(data.welcomeTitle) } fetchServerInfo() }, []) const onSubmit = async (e: React.FormEvent) => { e.preventDefault() const res = await adminFetcher("/server-info", { method: "PUT", body: { description, title } }) if (res.status === 200) { setToast({ type: "success", text: "Server info updated" }) setDescription(description) setTitle(title) } else { setToast({ text: "Something went wrong", type: "error" }) } } return (
setTitle(e.target.value)} />