Skip to content

Commit

Permalink
fix: πŸ› #91
Browse files Browse the repository at this point in the history
βœ… Closes: #91
  • Loading branch information
waynewyang committed Jan 19, 2024
1 parent 8bfa873 commit df7f379
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/components/table/view/carReplica/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ export default ({
independent: {
carId: {
width: "20%",
render: (value) => (
<Link href={`${config_carReplicaDetailPageRoot}/${value}`}>
render: (value, record) => (
<Link
href={`${config_carReplicaDetailPageRoot}?carId=${value}&matchingId=${record.matchingId}`}
>
{value}
</Link>
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,28 @@ import { useSelector } from "react-redux"

export default () => {
const router = useRouter()
const { id } = router.query
const { carId, matchingId } = router.query
const [carReplica, setCarReplica] = useState<ValueFields<CarReplica>>()
const network = useSelector(
(state: { network: { network: string } }) => state.network.network
)

useEffect(() => {
if (id) {
if (matchingId) {
getCarReplica({
network,
queryFilter: { conditions: [{ carId: id }] },
queryFilter: {
and: [
{ conditions: [{ carId }] },
{ conditions: [{ matchingId }] },
],
},
}).then((res) => {
const result = res.data
setCarReplica(result![0])
})
}
}, [id])
}, [matchingId])

return <>{carReplica && <CarReplicaDescription data={carReplica} />}</>
}

0 comments on commit df7f379

Please sign in to comment.