You should delete the await from your query. You are using a .then() so the await is an error. And therefore, you don’t need async in the function definition.
You need to return your results inside of the query’s .then() function. And, you also need to return the result of the Promise’s then().
To add each item to the array, you should use the array’s push() function .
You want something like this (not tested):
export function getTarif(saison_id, typeChalet, memberType, famille) {
return wixData.query("tarif")
.find()
.then(async (results) => {
let rowTarifCount = results.totalCount;
if (rowTarifCount > 0) {
let rowTarif = results.items;
let index = 0;
let periodTarif = new Array();
for (let index = 0; index < rowTarif.length; index++) {
let tabl = {
"period": element._id,
"prixDay": element.prixDay,
"prixHebdo": element.prixHebdo,
"prixMensuel": element.prixMensuel
}
periodTarif.push(tabl);
};
console.log('"getTarif: periodTarifperiodTarifperiodTarif => \n' + JSON.stringify(periodTarif));
return periodTarif;
}
})
.catch((err) => {
console.log("get tarif is ERROR " + err);
console.error(err);
})
}
See the section Returning in a .then() in the article Working with Promises.
See the article Promises, Promises for a further explanation on Promises.