@@ -2,8 +2,9 @@ import { CACHE_TIMES } from '@buildeross/constants/cacheTimes'
22import { PUBLIC_DEFAULT_CHAINS } from '@buildeross/constants/chains'
33import type { CandidateGroup } from '@buildeross/sdk'
44import { getCandidateGroup } from '@buildeross/sdk'
5+ import { getDAOAddresses } from '@buildeross/sdk/contract'
56import { useChainStore } from '@buildeross/stores'
6- import { CHAIN_ID } from '@buildeross/types'
7+ import { AddressType , CHAIN_ID } from '@buildeross/types'
78import { Box , Button , Flex , Stack , Text } from '@buildeross/zord'
89import { GetServerSideProps } from 'next'
910import { useRouter } from 'next/router'
@@ -201,7 +202,7 @@ CandidateDetailPage.getLayout = getDaoLayout
201202
202203export const getServerSideProps : GetServerSideProps = async ( context ) => {
203204 const network = context . params ?. network as string
204- // const token = context.params?.token as string
205+ const token = context . params ?. token as AddressType
205206 const candidateId = context . params ?. candidateId as string
206207
207208 // Validate network
@@ -213,6 +214,12 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
213214 return { notFound : true }
214215 }
215216
217+ const addresses = await getDAOAddresses ( validChain . id , token )
218+
219+ if ( ! addresses ) {
220+ return { notFound : true }
221+ }
222+
216223 // Fetch candidate data server-side
217224 let initialData : CandidateGroup | undefined
218225 try {
@@ -233,8 +240,10 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
233240
234241 return {
235242 props : {
243+ addresses,
236244 candidateId,
237245 initialData : initialData || null ,
246+ chainId : validChain . id ,
238247 } ,
239248 }
240249}
0 commit comments