Unable to display list on the web, is it a permission issue, or wrong coding?

The data displays on preview but not on the web. Can you help me please.
import wixData from ‘wix-data’;
function getdata(){
let query = wixData.query(‘HabitatAbordable’);
return query.limit(200).find().then(results => {
console.log(‘getData’, results);
return results.items;
});
}
$w.onReady( () => {
$w(’ #habitatwrite ‘).onAfterSave( () => {
getdata().then ((items) => {
$w(’ #habitatlist ').data = items;
});
});
//TODO: write your page related code here…
// Gets today’s date
const today = new Date();
// Sets the property of the text element to be a string representing today’s date in the user’s local format
$w(" #dateText ").text = today.toLocaleDateString();

});

see on : https://www.habitatsevolutifs.com/formulaire-d-insciption-1 (web site)

Preview mode

Please check the reply on the old post and act on that first.
https://www.wix.com/corvid/forum/community-discussion/collect-and-display-user-generated-content-1?origin=member_comments_page

If it is still happening after that, then please come back and tell us what you have done and changed so far etc.