Skip to content

Commit

Permalink
fix(apps/furo): set chainId to 1 automatically if query param not pre…
Browse files Browse the repository at this point in the history
…sent
  • Loading branch information
chillichelli committed Aug 6, 2022
1 parent bba7897 commit 91c1a57
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions apps/furo/pages/user/[address]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,22 @@ interface Props {
}
}
export const getServerSideProps: GetServerSideProps<Props> = async ({ query }) => {
if (typeof query.chainId !== 'string' || typeof query.address !== 'string') return { props: {} }
if (typeof query.address !== 'string') return { props: { fallback: {} } }
const chainId = ((query.chainId as string) || ChainId.ETHEREUM).toString()

return {
props: {
fallback: {
[`/api/user/${query.chainId}/${query.address}/streams`]: (await getUserStreams(
query.chainId,
query.address
)) as Streams,
[`/api/user/${query.chainId}/${query.address}/vestings`]: (await getUserVestings(
query.chainId,
query.address
)) as Vestings,
[`/api/user/${chainId}/${query.address}/streams`]: (await getUserStreams(chainId, query.address)) as Streams,
[`/api/user/${chainId}/${query.address}/vestings`]: (await getUserVestings(chainId, query.address)) as Vestings,
},
},
}
}

const UserDashboard: FC<InferGetServerSidePropsType<typeof getServerSideProps>> = ({ fallback }) => {
const router = useRouter()
const chainId = Number(router.query.chainId) || ChainId.ETHEREUM
const chainId = router.query.chainId ? Number(router.query.chainId) : ChainId.ETHEREUM
const address = router.query.address as string
const show = router.query.show

Expand Down

0 comments on commit 91c1a57

Please sign in to comment.