Fix login button — use onPointerUp for cross-platform touch support
This commit is contained in:
+7
-5
@@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState, useRef } from 'react';
|
import { useRef, useState } from 'react';
|
||||||
|
|
||||||
export default function LoginPage() {
|
export default function LoginPage() {
|
||||||
const [error, setError] = useState('');
|
const [error, setError] = useState('');
|
||||||
@@ -19,7 +19,7 @@ export default function LoginPage() {
|
|||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
body: JSON.stringify({ password }),
|
body: JSON.stringify({ password }),
|
||||||
});
|
});
|
||||||
if (!res.ok) throw new Error('Invalid password');
|
if (!res.ok) throw new Error('bad');
|
||||||
window.location.href = '/';
|
window.location.href = '/';
|
||||||
} catch {
|
} catch {
|
||||||
setError('Invalid password');
|
setError('Invalid password');
|
||||||
@@ -58,9 +58,8 @@ export default function LoginPage() {
|
|||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
autoFocus
|
|
||||||
autoComplete="current-password"
|
autoComplete="current-password"
|
||||||
onKeyDown={e => e.key === 'Enter' && handleLogin()}
|
onKeyDown={e => { if (e.key === 'Enter') handleLogin(); }}
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
background: '#faf9f6',
|
background: '#faf9f6',
|
||||||
@@ -73,6 +72,7 @@ export default function LoginPage() {
|
|||||||
marginBottom: error ? '6px' : '16px',
|
marginBottom: error ? '6px' : '16px',
|
||||||
display: 'block',
|
display: 'block',
|
||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
|
WebkitAppearance: 'none',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ export default function LoginPage() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={handleLogin}
|
onPointerUp={handleLogin}
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
background: '#2d5a3d',
|
background: '#2d5a3d',
|
||||||
@@ -95,6 +95,8 @@ export default function LoginPage() {
|
|||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
display: 'block',
|
display: 'block',
|
||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
|
WebkitAppearance: 'none',
|
||||||
|
touchAction: 'manipulation',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{loading ? 'Signing in...' : 'Sign in'}
|
{loading ? 'Signing in...' : 'Sign in'}
|
||||||
|
|||||||
Reference in New Issue
Block a user