fix: mobile/tablet Geräteerkennung in LoginPage → Redirect zu /mobile/login

- useEffect prüft Bildschirmbreite (<1024px) + User-Agent (Mobi/Android/iPad/iPhone)
- Tablet/Handy wird automatisch zu /mobile/login weitergeleitet
- Desktop bleibt auf /login

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 23:22:11 +02:00
parent edb1568801
commit 4a1dec7ae7
+9 -2
View File
@@ -1,10 +1,17 @@
import { useState } from 'react' import { useState, useEffect } from 'react'
import { Link, useLocation } from 'react-router-dom' import { Link, useLocation, useNavigate } from 'react-router-dom'
import { useAuth } from '../context/AuthContext' import { useAuth } from '../context/AuthContext'
export function LoginPage() { export function LoginPage() {
const { login } = useAuth() const { login } = useAuth()
const location = useLocation() const location = useLocation()
const navigate = useNavigate()
// Auf Mobilgeräten / Tablets → mobile Login-Seite
useEffect(() => {
const isMobile = window.innerWidth < 1024 || /Mobi|Android|Tablet|iPad|iPhone/i.test(navigator.userAgent)
if (isMobile) navigate('/mobile/login', { replace: true })
}, [])
const [email, setEmail] = useState('') const [email, setEmail] = useState('')
const [password, setPassword] = useState('') const [password, setPassword] = useState('')
const [error, setError] = useState('') const [error, setError] = useState('')