From 52bebdb301311d0508acd2402512e8d65720e521 Mon Sep 17 00:00:00 2001 From: jsun969 Date: Sun, 18 Feb 2024 21:39:05 +1030 Subject: [PATCH] fix(header): disable payment check when user not exist --- src/components/Header.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Header.tsx b/src/components/Header.tsx index ea3e8824..ad7ffcd5 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -28,7 +28,12 @@ export default function Header() { }); const checkUserPaid = useSWR<{ paid: boolean }>(['payment'], fetcher.get.query, { - isPaused: () => clerkUser.isLoaded && !clerkUser.isSignedIn, + isPaused: () => { + if (clerkUser.isLoaded && !clerkUser.isSignedIn) { + return true; + } + return !checkUserExists.data?.exists; + }, }); const [isScrolled, setIsScrolled] = useState(false);