"use client"; import React from "react"; import { useState, useRef } from "react"; import styles from "../../../../styles/modules/AdminArticlesCreate.module.scss"; import { PostArticle } from "../../../../types/postData"; import Markdown from "../../../Markdown"; export default function AdminArticlesCreate() { const [formData, setFormData] = useState(null); const [markdown, setMarkdown] = useState(""); const titleRef = useRef(null); function handleFormChange({ newMarkdownText = markdown }) { setFormData({ name: titleRef.current.value.replaceAll(" ", "%20"), title: titleRef.current.value, introduction: "test intro", markdown: markdown, categoryId: 1, }); setMarkdown(newMarkdownText); } async function postData() { console.log(formData); await fetch("/api/articles/create", { method: "POST", headers: { Accept: "application/json", "Content-Type": "application/json", }, body: JSON.stringify(formData), }); } return (

Create a new article

contenttable
{ handleFormChange({}); }} type="text" name="title" placeholder="title" ref={titleRef} />
); }