Seite für einzelne Spiele

This commit is contained in:
klaas 2024-09-29 01:31:06 +02:00
parent 6862abf583
commit 550a69688d
5 changed files with 76 additions and 11 deletions

View File

@ -1,11 +0,0 @@
'use client'
import React from 'react'
function error({error}: {error: Error}) {
return (
<div>error {error.message}</div>
)
}
export default error

View File

@ -0,0 +1,37 @@
import React from 'react'
import Link from "next/link";
type response = {
message: string;
game: spiel;
}
type spiel = {
id: number;
name: string;
material: string;
regeln:string;
variationen: string;
dauer: string;
type: number;
};
async function spiel({params}:{params:{id:number}}) {
const response = await fetch("http://localhost:2006/spiele/"+params.id);
const data:response[] = await response.json();
console.log(data);
const game: spiel = data.game;
return (
<div>
<h1> {game.name} </h1>
Material: {game.material}<br/>
Dauer: <p>{game.dauer}</p>
<h2>Regeln:</h2><p> {game.regeln}</p>
<h2>Variationen:</h2> <p> {game.variationen}</p>
</div>
)
}
export default spiel

View File

@ -0,0 +1,15 @@
import React from 'react'
function trainings({children}: {children: React.ReactNode}) {
return (
<div>
{children}
</div>
)
}
export default trainings

24
app/components/Login.tsx Normal file
View File

@ -0,0 +1,24 @@
import React from 'react'
function Login() {
return (
<div>
<form>
<label>
Username
<input type="text" name="username" />
</label>
<label>
Password
<input type="password" name="password" />
</label>
<button type="submit">Login</button>
</form>
<script>
console.log("Login")
</script>
</div>
)
}
export default Login