mirror of
https://gitlab1.ptb.de/aj2021/l-pa-so.git
synced 2024-02-04 23:49:43 +00:00
Merge branch 'dev' into 'dev-serverlist'
Dev See merge request aj2021/l-pa-so!3
This commit is contained in:
commit
94d2c0a751
1
website/.gitignore
vendored
1
website/.gitignore
vendored
|
@ -7,3 +7,4 @@ vite.config.ts.timestamp-*
|
|||
temp
|
||||
config
|
||||
backend_files
|
||||
/static/tournament.json
|
|
@ -1,16 +1,26 @@
|
|||
<script>
|
||||
import {onMount} from "svelte";
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
let data = {};
|
||||
onMount(async () => {
|
||||
let data = {};
|
||||
let player = [];
|
||||
let games = [];
|
||||
onMount(async () => {
|
||||
const response = await fetch('/api/read-tournament');
|
||||
data = await response.json();
|
||||
player = String(data.player).split(",");
|
||||
games = String(data.games).split(",");
|
||||
});
|
||||
</script>
|
||||
|
||||
<h2>Aktuelles Tunier</h2>
|
||||
<h3>Diese Spiele werden Gespielt:</h3>
|
||||
<p>{data.games}</p>
|
||||
{#each games as game}
|
||||
<p>{game}</p>
|
||||
{/each}
|
||||
|
||||
<h3>Die Teilnehmer lauten: </h3>
|
||||
<p>{data.player}</p>
|
||||
<h3>Die Teilnehmer lauten:</h3>
|
||||
{#each player as singlePlayer}
|
||||
<p>Spieler:</p>
|
||||
<p>{singlePlayer.split("|")[0]}</p>
|
||||
<p>Punktzahl:</p>
|
||||
<p>{singlePlayer.split("|")[1]}</p>
|
||||
{/each}
|
||||
|
|
|
@ -5,5 +5,5 @@ export async function GET() {
|
|||
const filePath = path.resolve('static/tournament.json');
|
||||
const data = await fs.readFile(filePath, 'utf8');
|
||||
const json = JSON.parse(data);
|
||||
return Response.json(json)
|
||||
return Response.json(json);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
player = [];
|
||||
const inputs = document.querySelectorAll('.Teilnehmer');
|
||||
inputs.forEach((input) => {
|
||||
player.push(input.value);
|
||||
player.push(input.value + '|' + 0);
|
||||
});
|
||||
return player;
|
||||
}
|
||||
|
|
1
website/static/tournament.json
Normal file
1
website/static/tournament.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"games":["Test 1","Test 2","Test 3","Test 4"],"player":["Test 1|0","Test 2|0","Test 3|0","Test 4|0"]}
|
Loading…
Reference in New Issue
Block a user