I am facing an issue while trying to run this function:
"use server";
export const addProduct = async (formData: FormData, imageUrl: string) => {
const productName = formData.get("productName")?.toString();
const description = formData.get("description")?.toString();
const location = formData.get("location")?.toString();
if (!productName || !description || !imageUrl || !location) {
throw Error("Missing required fields");
}
};
<form className="flex flex-col gap-4 text-lg" action={addProduct(imageUrl)}>
Errors:
Type '(formData: FormData, imageUrl: string) => Promise<never>' is not assignable to type 'string | ((formData: FormData) => void) | undefined'. Type '(formData: FormData, imageUrl: string) => Promise<never>' is not assignable to type '(formData: FormData) => void'. Target signature provides too few arguments. Expected 2 or more, but got 1.
No matter how many arguments I add to the addProduct function, the error persists, possibly due to incorrect types being used.