import { API_BASE } from "../../config/api.config"; import type { FormData } from "../../config/interfaces.config"; export const submitFormData = async ( data: FormData, username: string | null, ) => { console.warn("submitFormData is fetching!"); // await new Promise((resolve) => setTimeout(resolve, 3000)); // Wait 3 seconds const response = await fetch( `${API_BASE}/default/new-entry?username=${username}`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify(data), }, ); if (!response.ok) { const error = await response.text(); throw new Error(error || "Form submission failed"); } return; };