mirror of
https://github.com/Vale54321/schafkop-neu.git
synced 2025-12-15 19:29:34 +01:00
add basic github api
This commit is contained in:
@@ -1,22 +1,10 @@
|
||||
const btn = document.getElementById('pingBtn');
|
||||
const versionBtn = document.getElementById('versionBtn');
|
||||
const out = document.getElementById('result');
|
||||
|
||||
btn?.addEventListener('click', async () => {
|
||||
out.textContent = 'Requesting /api/ping…';
|
||||
try {
|
||||
const res = await fetch('/api/ping');
|
||||
const json = await res.json();
|
||||
out.textContent = JSON.stringify(json, null, 2);
|
||||
} catch (err) {
|
||||
out.textContent = 'Error: ' + (err?.message || String(err));
|
||||
}
|
||||
});
|
||||
|
||||
versionBtn?.addEventListener('click', async () => {
|
||||
out.textContent = 'Requesting /api/version…';
|
||||
try {
|
||||
const res = await fetch('/api/version');
|
||||
const res = await fetch('/api');
|
||||
const json = await res.json();
|
||||
out.textContent = JSON.stringify(json, null, 2);
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user