Predicates query added URL without trailing slash as defined in link-resolver

for an overview page I query all my cases with:

const doc = await $prismic.api.query($prismic.predicates.at('document.type', 'case'), {
	pageSize: 33,
});

return {
    cases: doc.results,
};

Now with the new code it adds an URL value in the results which does not go through my link-resolver.js and does not follow any other rules I have defined in my code, It should append a / at the end.

my link resolver looks like:

export default function (doc) {
   	if (doc.isBroken) return '/404';

     // custom pages
    if (doc.type === 'home') return '/';
    if (doc.type === 'over_ons') return '/over-ons/';
    if (doc.type === 'default') return `/${doc.uid}/`;

    // overview pages
    if (doc.type === 'cases') return '/cases/';

    // detail pages
    if (doc.type === 'case') return `/cases/${doc.uid}/`;

    return '/404';
}

extra options i added in the nuxt.config.js

prismic:  {
  apiOptions: {
    routes: [
      {
         type: 'case',
		path: '/cases/:uid/'				
      },
      ...
     ],
  },
},


router: {
	trailingSlash: true,
},

Result I get is:
/cases/test

what I should have gotten:
/cases/test/

Hey Max,

Sorry about the delay on the reply with this one.

Is this happening on localhost on or on your live website? I’ll also check if this might be an issue with the new routes function that your using.

On both, I temporarily fixed it with:

doc.results.map((i) => {
   i.url = `${i.url}/`;
});

I removed cache, rebuild node_modules, removed .nuxt, tested with different values in the config’s

It seems like it already has set the URL before it goes through <prismic-link> but it doesn’t go through the link-resolver so I’m curious how it’s aware of the structure of my project.

I’m glad you figured out a workaround for now.

The URL should be created from the routes in the the Nuxt.Config now I imagine so maybe that renders the link resolver obsolete. I’m not 100% sure. I’m going to try and confirm this with @alws & @hugo.villain.