Big thanks for the advise @yisrael-wix . I transformed all the promise call as suggested. It seems to work well in the backend. All object in return has data.
But I always receive undefined while calling it from the frontend. So I converted the frontend call in the backend to see the result. I am receiving a message from the Wix editor that the function is a type void. Here the message received from the converted backend function:

See the getTarifReserv function. Is it right to say this is because of the void function I am receiving an undefined
export function getTarifReserv(user) {
return wixData.query("myParams")
.eq("title", "Reservation")
.eq("userId", user._id)
.find()
.then((results) => {
let rowParam = results.items[0];
if (rowParam !== null && rowParam !== undefined) {
return {
"total": rowParam.cout,
"period": rowParam.period
};
} else {
let err = "getTarifReserv: 2 ERREUR Logique, pas de record MyParams pour Reservation pour userID = " + user._id;
console.error(err);
return {
"total": 0,
"period": []
};
}
})
.catch((err) => {
console.error(err);
})
}
Can you help for that part too. to resolve the undefined problem. Here is the front end function:
export function calculTarif(selChalet, selFrom, selTo, selMbr, selGroup, selFamille, member) {
let dollar = 0;
return estimeTarif(selChalet, selFrom, selTo, selMbr, selGroup, selFamille, member)
.then((tarif) => {
let total = 0;
return tarif;
})
.then(tarif => {
//let calcDollar =
return getTarifReserv(member)
.then(response => {
dollar = selTarif = cout = response.cout;
periodTarif = response.period;
if (dollar === 0) {
$w('#tarif').text = $w('#adminTarif').text = "?";
} else {
let tmp = cout.toLocaleString();
$w('#adminTarif').text = $w('#tarif').text = tmp;
}
return response;
})
})
.catch((err) => {
console.error(err);
});
}