File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
app/[locale]/(user)/publishers/[publisherSlug] Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -17,12 +17,27 @@ const userInfo = graphql(`
1717 }
1818 }
1919` ) ;
20+
21+ const extractPublisherId = ( publisherSlug : any ) => {
22+ // If the param contains an underscore, split and take the last part
23+ if ( publisherSlug . includes ( '_' ) ) {
24+ return publisherSlug . split ( '_' ) . pop ( ) ;
25+ }
26+
27+ // Otherwise, return the param as is (it's already just the ID)
28+ return publisherSlug ;
29+ } ;
30+
2031export async function generateMetadata ( {
2132 params,
2233} : {
2334 params : { publisherSlug : string } ;
2435} ) : Promise < Metadata > {
25- const data = await GraphQL ( userInfo , { } , { userId : params . publisherSlug } ) ;
36+ const data = await GraphQL (
37+ userInfo ,
38+ { } ,
39+ { userId : extractPublisherId ( params . publisherSlug ) }
40+ ) ;
2641
2742 const user = data . userById ;
2843
@@ -58,5 +73,9 @@ export default function PublisherPage({
5873} : {
5974 params : { publisherSlug : string } ;
6075} ) {
61- return < PublisherPageClient publisherSlug = { params . publisherSlug } /> ;
76+ return (
77+ < PublisherPageClient
78+ publisherSlug = { extractPublisherId ( params . publisherSlug ) }
79+ />
80+ ) ;
6281}
You can’t perform that action at this time.
0 commit comments