feat: implement dynamic API base URL and add language toggle in MainForm

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-05-04 22:03:21 +02:00
parent ab9cfd6cbf
commit 4df6d243f3
4 changed files with 46 additions and 9 deletions
+8 -5
View File
@@ -40,7 +40,7 @@ export const confirmUser = async (username) => {
console.log(tableName);
const [createTable] = await pool.query(
`CREATE TABLE IF NOT EXISTS ${tableName} (
`CREATE TABLE IF NOT EXISTS ? (
id INT AUTO_INCREMENT PRIMARY KEY,
Vorname VARCHAR(100) NOT NULL,
Nachname Varchar(100) NOT NULL,
@@ -56,14 +56,16 @@ export const confirmUser = async (username) => {
Plz_Ort Varchar(100),
Zahlungsmethode Varchar(100),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)`
)`,
[tableName],
);
if (createTable) {
let nextID;
const getNextID = async () => {
const [rows] = await pool.query(
`SELECT id FROM ${tableName} ORDER BY id DESC LIMIT 1`
`SELECT id FROM ? ORDER BY id DESC LIMIT 1`,
[tableName],
);
nextID = rows.length > 0 ? rows[0].id + 1 : 1;
};
@@ -87,8 +89,9 @@ export const newEntry = async (formData, username) => {
const tableName = confirmation.tableName;
const [result] = await pool.query(
`INSERT INTO ${tableName} (Vorname, Nachname, EMail, Telefonnummer, Lose, Firmenname, Vorname_Geschaeftlich, Nachname_Geschaeftlich, EMail_Geschaeftlich, Telefonnummer_Geschaeftlich, Strasse_Hausnr, Plz_Ort, Zahlungsmethode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
`INSERT INTO ? (Vorname, Nachname, EMail, Telefonnummer, Lose, Firmenname, Vorname_Geschaeftlich, Nachname_Geschaeftlich, EMail_Geschaeftlich, Telefonnummer_Geschaeftlich, Strasse_Hausnr, Plz_Ort, Zahlungsmethode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
[
tableName,
formData.firstName,
formData.lastName,
formData.email,
@@ -102,7 +105,7 @@ export const newEntry = async (formData, username) => {
formData.street,
formData.postalCode,
formData.paymentMethod,
]
],
);
return { success: true, insertId: result.insertId };