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
This commit is contained in:
@@ -15,7 +15,7 @@ SECRET_KEY = env('SECRET_KEY')
|
|||||||
|
|
||||||
DEBUG = env('DEBUG', default=True)
|
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 = [
|
INSTALLED_APPS = [
|
||||||
'unfold',
|
'unfold',
|
||||||
@@ -142,7 +142,13 @@ if CORS_ALLOWED_ORIGINS:
|
|||||||
else:
|
else:
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
raise ValueError("CORS_ALLOWED_ORIGINS must be explicitly configured in production")
|
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
|
CORS_ALLOW_CREDENTIALS = True
|
||||||
|
|
||||||
UNFOLD = {
|
UNFOLD = {
|
||||||
|
|||||||
@@ -7,15 +7,17 @@ import { Loader2 } from "lucide-react"
|
|||||||
|
|
||||||
export default function HomePage() {
|
export default function HomePage() {
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { token } = useAuth()
|
const { token, isHydrated } = useAuth()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!isHydrated) return
|
||||||
|
|
||||||
if (token) {
|
if (token) {
|
||||||
router.push("/dashboard")
|
router.push("/dashboard")
|
||||||
} else {
|
} else {
|
||||||
router.push("/login")
|
router.push("/login")
|
||||||
}
|
}
|
||||||
}, [token, router])
|
}, [token, isHydrated, router])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex items-center justify-center">
|
<div className="min-h-screen flex items-center justify-center">
|
||||||
|
|||||||
Reference in New Issue
Block a user