Skip to content

Commit

Permalink
fix(TermsOfUseUpdateDialog): don't open on the /terms-of-use page
Browse files Browse the repository at this point in the history
  • Loading branch information
BrickheadJohnny committed Oct 28, 2024
1 parent 24b0ff4 commit 01c58be
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/v2/components/TermsOfUseUpdateDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { useDisclosure } from "@/hooks/useDisclosure"
import useUser from "components/[guild]/hooks/useUser"
import { SignedValidation, useSubmitWithSign } from "hooks/useSubmit"
import { usePathname } from "next/navigation"
import { useEffect } from "react"
import fetcher from "utils/fetcher"
import { Anchor } from "./ui/Anchor"
Expand All @@ -20,10 +21,12 @@ const TermsOfUseUpdateDialog = () => {
const { id, tosAccepted, mutate } = useUser()
const { isOpen, onOpen, onClose } = useDisclosure()

const pathname = usePathname()

useEffect(() => {
if (!id) return
if (!id || pathname?.includes("terms-of-use")) return
if (!tosAccepted && !isOpen) onOpen()
}, [id, tosAccepted, isOpen, onOpen])
}, [id, pathname, tosAccepted, isOpen, onOpen])

const { onSubmit, isLoading } = useSubmitWithSign(
(signedValidation: SignedValidation) =>
Expand Down

0 comments on commit 01c58be

Please sign in to comment.