Reputation: 452
As of NextJs doc:
Behind the scenes, actions use the POST method, and only this HTTP method can invoke them.
When I submit my form with:
<form
action={customOnFormData}
>
my code:
const customOnFormData = async (formData: FormData) => {
dispatch(setLoading(true));
const userId = user.id;
const companyId = user.company?.id;
console.log("executed")
const result = await onCompanyForm(formData, { userId, companyId });
console.log("not executed")
dispatch(setLoading(false));
my terminal displays:
GET /formulaire-profil?_rsc=1qxp0 200 in 1340ms
Is my server action not executer because the form submission creates a GET, instead of a POST ? And why would it create a GET instead, other forms made the same way work well.
Thank you
Upvotes: 0
Views: 163