summaryrefslogtreecommitdiff
path: root/apps/web/src/components/landing
diff options
context:
space:
mode:
authorAhmet Kilinc <akx9@icloud.com>2025-07-16 01:05:42 +0100
committerAhmet Kilinc <akx9@icloud.com>2025-07-16 01:05:42 +0100
commitece9c78b16acd683f09b0fcd7c7b515c64da52f9 (patch)
treed6bc7096bcb465fbcf1867d9b112035949dbe455 /apps/web/src/components/landing
parenteb49500592e5c50c5637c09ea585b065545f2135 (diff)
downloadopencut-ece9c78b16acd683f09b0fcd7c7b515c64da52f9.tar.gz
coderabbit comments
Diffstat (limited to 'apps/web/src/components/landing')
-rw-r--r--apps/web/src/components/landing/hero.tsx15
1 files changed, 13 insertions, 2 deletions
diff --git a/apps/web/src/components/landing/hero.tsx b/apps/web/src/components/landing/hero.tsx
index 54aba300..b1910dc5 100644
--- a/apps/web/src/components/landing/hero.tsx
+++ b/apps/web/src/components/landing/hero.tsx
@@ -16,16 +16,24 @@ export function Hero() {
const [csrfToken, setCsrfToken] = useState<string | null>(null);
useEffect(() => {
+ let isMounted = true;
fetch("/api/waitlist/token", {
credentials: "include",
})
.then((res) => res.json())
.then((data) => {
- if (data.token) {
+ if (isMounted && data.token) {
setCsrfToken(data.token);
}
})
- .catch((err) => console.error("Failed to fetch CSRF token:", err));
+ .catch((err) => {
+ console.error("Failed to fetch CSRF token:", err);
+ if (isMounted) {
+ toast.error("Security initialization failed", {
+ description: "Please refresh the page to continue.",
+ });
+ }
+ });
}, []);
const handleSubmit = async (e: React.FormEvent) => {
@@ -70,6 +78,9 @@ export function Hero() {
.then((res) => res.json())
.then((data) => {
if (data.token) setCsrfToken(data.token);
+ })
+ .catch((err) => {
+ console.error("Failed to refresh CSRF token:", err);
});
} else {
toast.error("Oops!", {