From e42f5e231509da429ef8be89c9e728ed5726ab71 Mon Sep 17 00:00:00 2001 From: Andrej Spielmann Date: Thu, 26 Mar 2026 13:52:24 +0100 Subject: [PATCH] Fix network access for iPhone testing - Add 192.168.101.111 to ALLOWED_HOSTS and CORS_ALLOWED_ORIGINS - Update frontend env to use network IP for API - Fix page redirect to wait for hydration --- backend/wrestleDesk/settings.py | 10 ++++++++-- frontend/src/app/page.tsx | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/backend/wrestleDesk/settings.py b/backend/wrestleDesk/settings.py index 05b5ca4..fa02801 100644 --- a/backend/wrestleDesk/settings.py +++ b/backend/wrestleDesk/settings.py @@ -15,7 +15,7 @@ SECRET_KEY = env('SECRET_KEY') DEBUG = env('DEBUG', default=True) -ALLOWED_HOSTS = env('ALLOWED_HOSTS', default='localhost,127.0.0.1,testserver').split(',') +ALLOWED_HOSTS = env('ALLOWED_HOSTS', default='localhost,127.0.0.1,testserver,192.168.101.111').split(',') INSTALLED_APPS = [ 'unfold', @@ -142,7 +142,13 @@ if CORS_ALLOWED_ORIGINS: else: if not DEBUG: raise ValueError("CORS_ALLOWED_ORIGINS must be explicitly configured in production") - CORS_ALLOWED_ORIGINS = ['http://localhost:3000', 'http://127.0.0.1:3000', 'http://localhost:5173', 'http://127.0.0.1:5173'] + CORS_ALLOWED_ORIGINS = [ + 'http://localhost:3000', + 'http://127.0.0.1:3000', + 'http://192.168.101.111:3000', + 'http://localhost:5173', + 'http://127.0.0.1:5173', + ] CORS_ALLOW_CREDENTIALS = True UNFOLD = { diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index 13ba949..01fa29c 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -7,15 +7,17 @@ import { Loader2 } from "lucide-react" export default function HomePage() { const router = useRouter() - const { token } = useAuth() + const { token, isHydrated } = useAuth() useEffect(() => { + if (!isHydrated) return + if (token) { router.push("/dashboard") } else { router.push("/login") } - }, [token, router]) + }, [token, isHydrated, router]) return (