File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const nextConfig = {
1313 'images.pexels.com' ,
1414 ] ,
1515 } ,
16+ redirects : ( ) => getRedirects ( ) ,
1617 // VRAIMENT PAS OUF
1718 eslint : {
1819 ignoreDuringBuilds : true ,
@@ -22,5 +23,25 @@ const nextConfig = {
2223 } ,
2324} ;
2425
26+ export async function getRedirects ( ) {
27+ try {
28+ const res = await fetch ( `${ process . env . STRAPI_API_URL } /redirects` , {
29+ headers : {
30+ Authorization : `Bearer ${ process . env . STRAPI_API_TOKEN } ` ,
31+ } ,
32+ } ) ;
33+ const data = await res . json ( ) ;
34+
35+ return data . map ( ( redirect ) => ( {
36+ source : redirect . source ,
37+ destination : redirect . destination ,
38+ permanent : redirect . permanent || false ,
39+ } ) ) ;
40+ } catch ( error ) {
41+ console . error ( 'Error fetching redirects:' , error ) ;
42+ return [ ] ;
43+ }
44+ }
45+
2546const withNextIntl = createNextIntlPlugin ( ) ;
2647export default withNextIntl ( nextConfig ) ;
You can’t perform that action at this time.
0 commit comments