export function properties_customizeQuery(request, route, query) {
/*console.log(request, request, route);*/
}
export function properties_beforeRouter(request) {
/*const encodedURL = request.path[0];
decode(encodedURL).then(decoded => {
console.log("backend: " + decoded);
});*/
}
export function properties_afterRouter(request, response) {
const encodedURL = request.path[0];
if (!encodedURL.includes('-')) {
const decoded = decodeString(encodedURL);
let splitURL = decoded.split('+');
if (splitURL.length > 1) {
switch (splitURL[1]) {
case 'nc':
response.data = 'nc'
return ok("Properties Details (Item)", response.data);
default:
console.log('default url');
}
}
}
}
Is it possible to route from an encoded url to a dynamic page?
My dynamic pages are set up like /property/{slug}
. I’m using the code above to handle the following:
The {slug}
has been encoded and will be decoded by routers.js
After decoding the URL will be {slug}+{modifier}
and the router has to handle it from there to render the proper page.
I need to show /property/{slug}
while sending the modifier as router data for further logic handling. The problem is my implementation is sending me to the dynamic page for the first item all the time, which I thought I could handle with the router data. The other problem is that the router data is always null.
I know I can use redirect alongside query parameters to achieve this as I have tried it and it worked. But I would really prefer to keep the URL masked while showing the users only the things I need them to see.
Any ideas on how to fix this would be greatly appreciated.