mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
see fidd
This commit is contained in:
parent
98d174d278
commit
3583b5ab53
3 changed files with 24 additions and 4 deletions
|
|
@ -70,6 +70,11 @@ export function Toolbar({
|
|||
const [openModal, setOpenModal] = useState(false);
|
||||
const [showToast, setShowToast] = useState(false);
|
||||
|
||||
console.log(propertyId, "PropertyID")
|
||||
console.log(portfolioId, "porfolio id")
|
||||
console.log(propertyMeta, "property meta")
|
||||
console.log(decentHomes, "decent homes")
|
||||
|
||||
function handleClickSettings() {
|
||||
console.log("Settings were clicked, implement me");
|
||||
}
|
||||
|
|
@ -175,7 +180,7 @@ export function Toolbar({
|
|||
onOpenChange={setOpenModal}
|
||||
propertyId={BigInt(propertyId)}
|
||||
portfolioId={portfolioId}
|
||||
address={propertyMeta.address}
|
||||
propertyMeta={propertyMeta}
|
||||
onSuccess={() => setShowToast(true)}
|
||||
/>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ export default async function DashboardLayout(props: {
|
|||
|
||||
const propertyId = params.propertyId ?? "";
|
||||
const portfolioId = params.slug ?? "";
|
||||
|
||||
|
||||
// The layout is a server component by default so we can fetch meta data here
|
||||
const propertyMeta = await getPropertyMeta(params.propertyId);
|
||||
|
|
|
|||
|
|
@ -12,24 +12,38 @@ import { Input } from "@/app/shadcn_components/ui/input";
|
|||
import { Label } from "@/app/shadcn_components/ui/label";
|
||||
import { useState, useEffect } from "react";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { PropertyMeta } from "@/app/db/schema/property";
|
||||
import { cache } from "react";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { AuthOptions } from "@/app/api/auth/[...nextauth]/authOptions";
|
||||
|
||||
interface BookSurveyModalProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
propertyId: bigint;
|
||||
portfolioId: string;
|
||||
address: string;
|
||||
propertyMeta: PropertyMeta;
|
||||
onSuccess?: () => void; // ✅ fix: properly declare optional callback
|
||||
}
|
||||
|
||||
const getSession = cache(async () => {
|
||||
const session = await getServerSession(AuthOptions);
|
||||
return session;
|
||||
});
|
||||
|
||||
export default function BookSurveyModal({
|
||||
open,
|
||||
onOpenChange,
|
||||
propertyId,
|
||||
portfolioId,
|
||||
address,
|
||||
propertyMeta,
|
||||
onSuccess, // ✅ fix: remove “?:” here, we already declared it optional in interface
|
||||
}: BookSurveyModalProps) {
|
||||
|
||||
const user = getSession();
|
||||
console.log(user, "user details");
|
||||
|
||||
|
||||
// 🧠 Simple mutation to call your HubSpot API
|
||||
const bookSurveyMutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
|
|
@ -37,7 +51,7 @@ export default function BookSurveyModal({
|
|||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
dealName: address,
|
||||
dealName: propertyMeta.address,
|
||||
pipelineId: "2400089278",
|
||||
dealStageId: "3660660975",
|
||||
propertyId: propertyId.toString(),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue