I’m trying to make a router, but not working, where am I wrong? Overall I changed the data from the example
//Read Our Wix Router API here wix-router - Velo API Reference - Wix.com
import {ok, notFound, WixRouterSitemapEntry} from “wix-router”;
import wixData from ‘wix-data’;
const peopleData =
wixData.query(“muzarim”).find().then( (results) => {
let tt= results.items
peopleData.push(tt)
})
.then( () => {
console.log(peopleData)
})
export function item_Router(request) {
// Get item name from URL request
const name = request.path[0];
// Get the item data by name
const data = peopleData[name];
// wixData.query(“muzarim”).find().then( (results) => {
// const data = results.items;
console.log(data);
if (data) {
// Define SEO tags
const seoData = {
title: data.sem,
description: This is a description of ${data.sem} page
,
noIndex: false ,
metaTags: {
“og:title”: data.sem,
“og:image”: data.image
}
};
// Render item page
return ok(“item-page”, data, seoData);
}
// Return 404 if item is not found
return notFound();
// });
}
export function item_SiteMap(sitemapRequest) {
// Convert the data to site map entries
const siteMapEntries = Object.keys(peopleData).map((name)=>{
const data= peopleData[name];
const entry = new WixRouterSitemapEntry(name);
entry.pageName = “item-page”; // The name of the page in the Wix editor to render
entry.url = “/item/” + name ; // Relative URL of the page
entry.title = data.sem; // For better SEO - Help Google
return entry;
});
// Return the site map entries
return siteMapEntries;
}