nuxt-netlify icon indicating copy to clipboard operation
nuxt-netlify copied to clipboard

Use the default Nuxt redirect as default for netlify redirect

Open espensgr opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe. Today you have to add a static array to the netlify config, as it is nice it would be nice to use a promise from an api call to get the redirects. Today we use the redirect settings in the nuxt.config, with an ajax call to the backend where we make the redirects.

Describe the solution you'd like It would be nice to have this module use the redirect function in the nuxt.config as a default. And if you would like to disable it add redirect: null or provide your own array, like you do today.

Additional context I'm using Nuxt 2.14.7 with full static generate.

espensgr avatar Oct 26 '20 11:10 espensgr

+1 I have to use sync-request package in order to fetch redirects from my backend, would be nice to have redirects prop as a function, to be able to use async requests inside. Here's the piece of code that handles exactly the same problem for the nuxt-sitemap module, in case it helps: https://github.com/nuxt-community/sitemap-module/blob/611dfb7d08be585e0641cc9a4d3c3548a90c8f03/lib/cache.js#L43.

DreaMinder avatar Jan 18 '21 23:01 DreaMinder

I opened a PR to fix this: https://github.com/juliomrqz/nuxt-netlify/pull/210 @juliomrqz please take a look when you can

DreaMinder avatar Mar 02 '21 14:03 DreaMinder