1- import { getTranslations } from 'next-intl/server ' ;
1+ import { useTranslations } from 'next-intl' ;
22import type { FC } from 'react' ;
33
44import { getClientContext } from '#site/client-context' ;
@@ -17,12 +17,15 @@ const getBlogCategory = (pathname: string) => {
1717 // hence we attempt to interpolate the full /en/blog/{category}/page/{page}
1818 // and in case of course no page argument is provided we define it to 1
1919 // note that malformed routes can't happen as they are all statically generated
20- const [ , , category = 'all' , , page = 1 ] = pathname . split ( '/' ) ;
20+ const [ , , category = 'all' , , page = 1 ] = pathname . split ( '/' ) as [
21+ unknown ,
22+ unknown ,
23+ BlogCategory ,
24+ unknown ,
25+ number ,
26+ ] ;
2127
22- const { posts, pagination } = getBlogData (
23- category as BlogCategory ,
24- Number ( page )
25- ) ;
28+ const { posts, pagination } = getBlogData ( category , Number ( page ) ) ;
2629
2730 return {
2831 category : category ,
@@ -32,9 +35,9 @@ const getBlogCategory = (pathname: string) => {
3235 } ;
3336} ;
3437
35- const BlogLayout : FC = async ( ) => {
38+ const BlogLayout : FC = ( ) => {
39+ const t = useTranslations ( ) ;
3640 const { pathname } = getClientContext ( ) ;
37- const t = await getTranslations ( ) ;
3841
3942 const mapCategoriesToTabs = ( categories : Array < BlogCategory > ) =>
4043 categories . map ( category => ( {
0 commit comments