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:
@@ -1,10 +1,17 @@
|
||||
import { useState } from 'react'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
import { useState, useEffect } from 'react'
|
||||
import { Link, useLocation, useNavigate } from 'react-router-dom'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
|
||||
export function LoginPage() {
|
||||
const { login } = useAuth()
|
||||
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 [password, setPassword] = useState('')
|
||||
const [error, setError] = useState('')
|
||||
|
||||
Reference in New Issue
Block a user