i have a complex form with images and attributes… when using append or set to adding the data in a vue quasar app it work fine but the problem is i receive a list of data even for single values for example:
const sendFormData = new FormData();
sendFormData.set('title', title.value || '');
and in the api(django view request.data) i get :
{...'title': ['']...}
but i want it to be like:
{...'title': ''...}
i want to use formData and wondering how can i fix this ? should i parse it back-end or is there a easy way that i am missing? i search and the only solution i find is to use a simple [key: string]: unknown object that different from using formData, thank you in advance.
… just to mention i have a function in the Pinia store to handle this like below but i don’t think it is related to the problem.
...const formData = payload;
try {
const Response = await api.post(
url,
formData,
{
headers: { Authorization: `JWT ${accessToken}` },
},
);...