+
+
{t("entry-id")}
{
borderRadius: "12px",
fontWeight: 700,
background: "linear-gradient(135deg, #2563eb, #1d4ed8)",
- "&:hover": { background: "linear-gradient(135deg, #1d4ed8, #1e40af)" },
+ "&:hover": {
+ background: "linear-gradient(135deg, #1d4ed8, #1e40af)",
+ },
}}
>
{seconds}s — {t("return-to-homepage")}
@@ -146,11 +161,11 @@ export const SuccessPage = () => {
{/* Thank-you note */}
-
-
+
+
{t("thank-you")}
diff --git a/frontend/src/utils/api/form.ts b/frontend/src/utils/api/form.ts
new file mode 100644
index 0000000..0229d7f
--- /dev/null
+++ b/frontend/src/utils/api/form.ts
@@ -0,0 +1,26 @@
+import { API_BASE } from "../../config/api.config";
+import type { FormData } from "../../config/interfaces.config";
+
+export const submitFormData = async (data: FormData, username: string) => {
+ console.warn("submitFormData is fetching!");
+
+ await new Promise((resolve) => setTimeout(resolve, 3000)); // Wait 3 seconds
+
+ const response = await fetch(
+ `${API_BASE}/default/new-entry?username=${username}`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(data),
+ },
+ );
+
+ if (!response.ok) {
+ const error = await response.text();
+ throw new Error(error || "Form submission failed");
+ }
+
+ return;
+};
diff --git a/frontend/src/utils/api/users.ts b/frontend/src/utils/api/users.ts
new file mode 100644
index 0000000..4e0e705
--- /dev/null
+++ b/frontend/src/utils/api/users.ts
@@ -0,0 +1,21 @@
+import { API_BASE } from "../../config/api.config";
+import Cookies from "js-cookie";
+
+export const fetchUsers = async () => {
+ console.warn("fetchUsers is fetching!");
+
+ const response = await fetch(`${API_BASE}/default/users`);
+ const data = await response.json();
+
+ return data;
+};
+
+export const confirmUser = async (username: string) => {
+ console.warn("confirmUser is fetching!");
+ const response = await fetch(
+ `${API_BASE}/default/confirm-user?username=${username}`,
+ );
+ const data = await response.json();
+ Cookies.set("selectedUser", username);
+ return data;
+};
diff --git a/frontend/src/utils/i18n/locales/de/de.json b/frontend/src/utils/i18n/locales/de/de.json
index cdaf863..0416628 100644
--- a/frontend/src/utils/i18n/locales/de/de.json
+++ b/frontend/src/utils/i18n/locales/de/de.json
@@ -14,7 +14,7 @@
"user": "Benutzer",
"next-id": "Nächste Eintragsnummer: ",
"form-submitted-successfully": "Formular erfolgreich übermittelt!",
- "orm-submission-failed": "Formularübermittlung fehlgeschlagen.",
+ "form-submission-failed": "Formularübermittlung fehlgeschlagen.",
"success": "Erfolg",
"error": "Fehler",
"cash": "Bar",
@@ -26,5 +26,7 @@
"thank-you": "Vielen Dank für Ihre Unterstützung der Claudius Akademie! Wir wünschen Ihnen viel Glück mit dem Los.",
"select-payment-method": "Zahlungsmethode auswählen",
"return-to-homepage": "Zurück",
- "qr-text": "PayPal QR-Code der Claudius Akademie"
+ "qr-text": "PayPal QR-Code der Claudius Akademie",
+ "loading": "Lädt...",
+ "greeting": "Hallo,"
}
\ No newline at end of file
diff --git a/frontend/src/utils/i18n/locales/en/en.json b/frontend/src/utils/i18n/locales/en/en.json
index 4bde327..5e47dcc 100644
--- a/frontend/src/utils/i18n/locales/en/en.json
+++ b/frontend/src/utils/i18n/locales/en/en.json
@@ -27,5 +27,7 @@
"thank-you": "Thank you for supporting the Claudius Akademie! We wish you the best of luck with your ticket.",
"select-payment-method": "Select Payment Method",
"return-to-homepage": "Return",
- "qr-text": "PayPal QR-Code from the Claudius Akademie"
+ "qr-text": "PayPal QR-Code from the Claudius Akademie",
+ "loading": "Loading...",
+ "greeting": "Hello,"
}
\ No newline at end of file
diff --git a/frontend/src/utils/sender.ts b/frontend/src/utils/sender.ts
deleted file mode 100644
index 724447d..0000000
--- a/frontend/src/utils/sender.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { API_BASE } from "../config/api.config";
-import type { FormData } from "../config/interfaces.config";
-
-export const submitFormData = async (
- data: FormData,
- username: string | null,
-) => {
- if (username == null) {
- return { success: false, errorCode: "x001" };
- }
-
- try {
- const response = await fetch(
- `${API_BASE}/default/new-entry?username=${username}`,
- {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(data),
- },
- );
-
- if (!response.ok) {
- const errorText = await response.text();
- return { success: false, error: `Server error: ${errorText}` };
- }
-
- return { success: true };
- } catch (error) {
- return { success: false, error: (error as Error).message };
- }
-};
diff --git a/frontend/tests/test.local.js b/frontend/tests/test.local.js
new file mode 100644
index 0000000..9531c16
--- /dev/null
+++ b/frontend/tests/test.local.js
@@ -0,0 +1,13 @@
+import http from "k6/http";
+import { sleep } from "k6";
+
+export const options = {
+ vus: 100, // amount of users
+ duration: "60s", // duration of the test
+};
+
+export default function () {
+ http.get("http://localhost:8004/default/confirm-user?username=TheisGaedigk");
+ http.get("http://localhost:8004/default/users");
+ sleep(1);
+}
diff --git a/frontend/tests/test.server.js b/frontend/tests/test.server.js
new file mode 100644
index 0000000..3e4b4f1
--- /dev/null
+++ b/frontend/tests/test.server.js
@@ -0,0 +1,15 @@
+// Before running: Establish VPN connection first
+
+import http from "k6/http";
+import { sleep } from "k6";
+
+export const options = {
+ vus: 100, // amount of users
+ duration: "60s", // duration of the test
+};
+
+export default function () {
+ http.get("http://backend:8004/default/confirm-user?username=TheisGaedigk");
+ http.get("http://backend:8004/default/users");
+ sleep(0.5);
+}