diff --git a/salesmanagement/index.php b/salesmanagement/index.php index 1809430..194415a 100644 --- a/salesmanagement/index.php +++ b/salesmanagement/index.php @@ -1436,15 +1436,14 @@ const [error, setError] = useState(''); const [loading, setLoading] = useState(false); - const handleLogin = async (e) => { - e.preventDefault(); + const executeLogin = async (id, pw) => { setLoading(true); setError(''); try { const res = await fetch('api/sales_members.php?action=login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ member_id: memberId, password }) + body: JSON.stringify({ member_id: id, password: pw }) }); const data = await res.json(); if (data.success) { @@ -1463,6 +1462,17 @@ } }; + const handleLogin = (e) => { + e.preventDefault(); + executeLogin(memberId, password); + }; + + const handleAutoLogin = (id, pw) => { + setMemberId(id); + setPassword(pw); + executeLogin(id, pw); + }; + return (