ADD: added dockerfiles and a logger for the backend
This commit is contained in:
@@ -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 }
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user