sorted out redirect to property and set up the property page

This commit is contained in:
Khalim Conn-Kowlessar 2023-05-29 16:14:55 +01:00
parent 431c416f2d
commit 3ad7742773
2 changed files with 12 additions and 5 deletions

View file

@ -0,0 +1,7 @@
export default function () {
return (
<>
<h1> Hello world</h1>
</>
);
}

View file

@ -59,17 +59,17 @@ export default function Search({ params }: { params: { slug: string } }) {
}
}
const redirectToEpc = () => {
const redirectToProperty = () => {
if (data === null) return;
const res = data.rows.find(
(row: SearchResult) => row["lmk-key"] === currentlyToggled
);
) as SearchResult;
const portfolioId = params.slug;
const propertyId = res ? ["lmk-key"] : "";
const lmkKey = res["lmk-key"];
router.push(`/portfolio/${portfolioId}/property/${propertyId}`);
router.push(`/portfolio/${portfolioId}/property/${lmkKey}`);
};
const submitProps = {
@ -131,7 +131,7 @@ export default function Search({ params }: { params: { slug: string } }) {
<div className="flex justify-end">
<SelectAddressButton
buttonDisabled={addressButtonDisabled}
redirectFunc={redirectToEpc}
redirectFunc={redirectToProperty}
/>
</div>
</div>