From e8062431e455bb09604f0fe00d078e1581527eb2 Mon Sep 17 00:00:00 2001 From: aweso Date: Tue, 13 Jan 2026 21:31:46 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8B=A0=EA=B7=9C=20=ED=9A=8C=EC=9B=90?= =?UTF-8?q?=EC=82=AC=20=EA=B0=80=EC=9E=85=EC=9D=84=20=EA=B0=84=ED=8E=B8?= =?UTF-8?q?=ED=95=98=EA=B2=8C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=ED=95=98?= =?UTF-8?q?=EC=8B=A4=20=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20'?= =?UTF-8?q?=EC=9E=90=EB=8F=99=20=EC=99=84=EC=84=B1(=E2=9A=A1)'=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=EC=9D=84=20=EC=B6=94=EA=B0=80=ED=95=98=EC=98=80?= =?UTF-8?q?=EC=8A=B5=EB=8B=88=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit πŸ€– Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- barobill_registration/api.php | 45 ++++++++++-------- barobill_registration/index.php | 76 +++++++++++++++++++++++++++---- barobill_registration/init_db.php | 1 - 3 files changed, 93 insertions(+), 29 deletions(-) diff --git a/barobill_registration/api.php b/barobill_registration/api.php index 90aa0fe..960efd8 100644 --- a/barobill_registration/api.php +++ b/barobill_registration/api.php @@ -3,24 +3,34 @@ header('Content-Type: application/json'); require_once("../lib/mydb.php"); $method = $_SERVER['REQUEST_METHOD']; -$pdo = db_connect(); +try { + $pdo = db_connect(); -switch ($method) { - case 'GET': - handleGet($pdo); - break; - case 'POST': - handlePost($pdo); - break; - case 'PUT': - handlePut($pdo); - break; - case 'DELETE': - handleDelete($pdo); - break; - default: - echo json_encode(['error' => 'Method not allowed']); - break; + switch ($method) { + case 'GET': + handleGet($pdo); + break; + case 'POST': + handlePost($pdo); + break; + case 'PUT': + handlePut($pdo); + break; + case 'DELETE': + handleDelete($pdo); + break; + default: + http_response_code(405); + echo json_encode(['error' => 'Method not allowed']); + break; + } +} catch (Exception $e) { + http_response_code(500); + echo json_encode([ + 'error' => 'Backend Error', + 'message' => $e->getMessage(), + 'hint' => 'Check if the database table exists by running init_db.php' + ]); } function handleGet($pdo) { @@ -122,4 +132,3 @@ function handleDelete($pdo) { echo json_encode(['error' => $e->getMessage()]); } } -?> diff --git a/barobill_registration/index.php b/barobill_registration/index.php index 17e522a..9c52fb5 100644 --- a/barobill_registration/index.php +++ b/barobill_registration/index.php @@ -25,10 +25,18 @@ } - - - + + + + + + + + @@ -187,14 +195,30 @@ const [loading, setLoading] = useState(true); const [activeTab, setActiveTab] = useState('list'); const [editingMember, setEditingMember] = useState(null); + + // Auto-fill feature states + const [registerKey, setRegisterKey] = useState(0); + const [initialTestData, setInitialTestData] = useState({}); const fetchMembers = async () => { setLoading(true); try { const res = await fetch('api.php'); - const data = await res.json(); - setMembers(data.members || []); - } catch (e) { console.error(e); } + const text = await res.text(); + try { + const data = JSON.parse(text); + if (data.error) { + alert(`μ„œλ²„ 였λ₯˜: ${data.message || data.error}\n${data.hint || ''}`); + } + setMembers(data.members || []); + } catch (parseError) { + console.error("Invalid JSON response:", text); + alert("μ„œλ²„λ‘œλΆ€ν„° μ˜¬λ°”λ₯΄μ§€ μ•Šμ€ 응닡이 μˆ˜μ‹ λ˜μ—ˆμŠ΅λ‹ˆλ‹€. DB μ—°κ²° λ˜λŠ” ν…Œμ΄λΈ” 생성 μ—¬λΆ€λ₯Ό ν™•μΈν•΄μ£Όμ„Έμš”."); + } + } catch (e) { + console.error(e); + alert("톡신 였λ₯˜κ°€ λ°œμƒν–ˆμŠ΅λ‹ˆλ‹€."); + } setLoading(false); }; @@ -319,12 +343,44 @@ ) : (
-
-

μ‹ κ·œ νšŒμ›μ‚¬ κ°€μž…

-

μž…λ ₯된 μ •λ³΄λ‘œ λ°”λ‘œλΉŒ RegistCorp APIκ°€ ν˜ΈμΆœλ©λ‹ˆλ‹€.

+
+
+

μ‹ κ·œ νšŒμ›μ‚¬ κ°€μž…

+

μž…λ ₯된 μ •λ³΄λ‘œ λ°”λ‘œλΉŒ RegistCorp APIκ°€ ν˜ΈμΆœλ©λ‹ˆλ‹€.

+
+
- +
)} diff --git a/barobill_registration/init_db.php b/barobill_registration/init_db.php index ea5bf3e..6773c97 100644 --- a/barobill_registration/init_db.php +++ b/barobill_registration/init_db.php @@ -9,4 +9,3 @@ try { } catch (Exception $e) { echo "Error: " . $e->getMessage(); } -?>