diff --git a/components/booking/pages/AvailabilityPage.tsx b/components/booking/pages/AvailabilityPage.tsx index f985611dbe..756fb21f53 100644 --- a/components/booking/pages/AvailabilityPage.tsx +++ b/components/booking/pages/AvailabilityPage.tsx @@ -1,7 +1,6 @@ // Get router variables import { ChevronDownIcon, ChevronUpIcon, ClockIcon, CreditCardIcon, GlobeIcon } from "@heroicons/react/solid"; import * as Collapsible from "@radix-ui/react-collapsible"; -import { useContracts } from "contexts/contractsContext"; import dayjs, { Dayjs } from "dayjs"; import customParseFormat from "dayjs/plugin/customParseFormat"; import utc from "dayjs/plugin/utc"; @@ -37,16 +36,6 @@ const AvailabilityPage = ({ profile, eventType, workingHours }: Props) => { const { rescheduleUid } = router.query; const { isReady } = useTheme(profile.theme); const { t } = useLocale(); - const { contracts } = useContracts(); - - useEffect(() => { - if (eventType.metadata.smartContractAddress) { - const eventOwner = eventType.users[0]; - if (!contracts[(eventType.metadata.smartContractAddress || null) as number]) - router.replace(`/${eventOwner.username}`); - } - }, [contracts, eventType.metadata.smartContractAddress, router]); - const selectedDate = useMemo(() => { const dateString = asStringOrNull(router.query.date); if (dateString) { diff --git a/components/booking/pages/BookingPage.tsx b/components/booking/pages/BookingPage.tsx index ee0aeae9ab..d706f39f96 100644 --- a/components/booking/pages/BookingPage.tsx +++ b/components/booking/pages/BookingPage.tsx @@ -59,28 +59,7 @@ const BookingPage = (props: BookingPageProps) => { const { t, i18n } = useLocale(); const router = useRouter(); const { contracts } = useContracts(); - const { eventType } = props; - useEffect(() => { - if (eventType.metadata.smartContractAddress) { - const eventOwner = eventType.users[0]; - - if (!contracts[(eventType.metadata.smartContractAddress || null) as number]) - router.replace(`/${eventOwner.username}`); - } - }, [contracts, eventType.metadata.smartContractAddress, router]); - - /* - * This was too optimistic - * I started, then I remembered what a beast book/event.ts is - * Gave up shortly after. One day. Maybe. - * - const mutation = trpc.useMutation("viewer.bookEvent", { - onSuccess: ({ booking }) => { - // go to success page. - }, - });*/ - const mutation = useMutation(createBooking, { onSuccess: async ({ attendees, paymentUid, ...responseData }) => { if (paymentUid) { @@ -248,7 +227,9 @@ const BookingPage = (props: BookingPageProps) => { let web3Details; if (eventTypeDetail.metadata.smartContractAddress) { web3Details = { - userWallet: web3.currentProvider.selectedAddress, + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + userWallet: window.web3.currentProvider.selectedAddress, userSignature: contracts[(eventTypeDetail.metadata.smartContractAddress || null) as number], }; } @@ -390,7 +371,7 @@ const BookingPage = (props: BookingPageProps) => {