ADD: added dockerfiles and a logger for the backend

This commit is contained in:
hwinkel
2025-12-15 13:30:41 +01:00
parent 7ec17e1e8b
commit 435ad8e6e6
12 changed files with 183 additions and 19 deletions

View File

@@ -11,11 +11,11 @@ export async function loginUser(email:string, password: string) {
return res.json(); // { token: string }
}
export async function registerUser(email:string, password: string){
export async function registerUser(email:string, username:string, password: string){
const res = await fetch(`${API_URL}/register`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password }),
body: JSON.stringify({ email,username, password }),
});
if (!res.ok) throw new Error('Registrierung fehlgeschlagen');
return res.json(); // { token: string }

View File

@@ -1,4 +1,4 @@
import {loginUser} from "../api/user";
import {loginUser, registerUser} from "../api/user";
import { useState } from "react";
export default function LoginModal({ isOpen, onClose, onSuccess }: any) {
@@ -36,8 +36,12 @@ export default function LoginModal({ isOpen, onClose, onSuccess }: any) {
}
// TODO: Call registerUser API
// const res = await registerUser(email as string, username as string, password as string);
const res = await registerUser(email as string, username as string, password as string);
if (!res.ok) {
alert("Registration failed!");
return;
}
// TODO: Implement actual registration logic here
console.log("Registering with:", email, password);
// For now, let's just switch back to login after a "successful" registration