File tree Expand file tree Collapse file tree
app/[locale]/(pages)/news/archive/[...slug] Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,13 +7,14 @@ import { Flags } from '@/sanity/helpers/datasetHelpers'
77import type { PathType } from '@/sanity/queries/paths/getPaths'
88import ArchivedNews from '@/templates/archivedNews/ArchivedNews'
99
10+ type Params = Promise < { locale : string ; slug : string [ ] } >
1011//TODO types
11- async function getArchivedPageData ( params : any ) {
12- const { locale : routeLocale , slug : pagePathArray } = params
12+ async function getArchivedPageData ( params : Params ) {
13+ const { locale : routeLocale , slug : pagePathArray } = await params
1314 const locale = routeLocale === 'en-GB' ? 'en' : routeLocale
1415 if ( ! Flags . HAS_ARCHIVED_NEWS ) return { notFound : true }
1516
16- const pagePath = pagePathArray . join ( '/' )
17+ const pagePath = pagePathArray ? .join ( '/' )
1718
1819 const archivedItems = archivedNews . filter (
1920 e => e . slug === `/news/archive/${ pagePath } ` ,
@@ -32,7 +33,7 @@ async function getArchivedPageData(params: any) {
3233export async function generateMetadata ( {
3334 params,
3435} : {
35- params : any
36+ params : Params
3637} ) : Promise < Metadata > {
3738 const { locale, slug : pagePathArray } = await params
3839
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export const routing = defineRouting({
77 localePrefix : {
88 mode : 'as-needed' ,
99 prefixes : {
10+ 'en-GB' :"/en" ,
1011 'nb-NO' : '/no' ,
1112 'pt-BR' : '/pt' ,
1213 'es-AR' : '/es' ,
You can’t perform that action at this time.
0 commit comments