edia all routes

This commit is contained in:
2025-09-05 13:15:11 +02:00
parent 3872397082
commit a78a8dc3ce
8 changed files with 230 additions and 76 deletions

View File

@@ -46,7 +46,7 @@ function setupEventListeners() {
async function checkAuth() {
try {
const response = await fetch('/api/check-session');
const response = await fetch('/api/v1/web/check-session');
const result = await response.json();
if (!result.success) {
@@ -74,7 +74,7 @@ async function checkAuth() {
async function logout() {
try {
await fetch('/api/logout', { method: 'POST' });
await fetch('/api/v1/public/logout', { method: 'POST' });
window.location.href = '/adminlogin.html';
} catch (error) {
console.error('Logout failed:', error);
@@ -84,7 +84,7 @@ async function logout() {
async function loadStatistics() {
try {
const response = await fetch('/api/admin-stats');
const response = await fetch('/api/v1/admin/stats');
const stats = await response.json();
if (stats.success) {
@@ -100,7 +100,7 @@ async function loadStatistics() {
async function loadPageStatistics() {
try {
const response = await fetch('/api/admin-page-stats');
const response = await fetch('/api/v1/admin/page-stats');
const result = await response.json();
if (result.success) {
@@ -202,7 +202,7 @@ async function loadUsers() {
async function loadPlayers() {
try {
const response = await fetch('/api/admin-players');
const response = await fetch('/api/v1/admin/players');
const result = await response.json();
if (result.success) {
@@ -219,7 +219,7 @@ async function loadPlayers() {
async function loadRuns() {
try {
const response = await fetch('/api/admin-runs');
const response = await fetch('/api/v1/admin/runs');
const result = await response.json();
if (result.success) {
@@ -236,7 +236,7 @@ async function loadRuns() {
async function loadLocations() {
try {
const response = await fetch('/api/admin-locations');
const response = await fetch('/api/v1/admin/locations');
const result = await response.json();
if (result.success) {
@@ -253,7 +253,7 @@ async function loadLocations() {
async function loadAdminUsers() {
try {
const response = await fetch('/api/admin-adminusers');
const response = await fetch('/api/v1/admin/adminusers');
const result = await response.json();
if (result.success) {
@@ -537,22 +537,22 @@ async function handleAddSubmit(e) {
switch(currentDataType) {
case 'players':
endpoint = isEdit ? `/api/admin-players/${editId}` : '/api/admin-players';
endpoint = isEdit ? `/api/v1/admin/players/${editId}` : '/api/v1/admin/players';
successMessage = isEdit ? 'Spieler erfolgreich aktualisiert' : 'Spieler erfolgreich hinzugefügt';
method = isEdit ? 'PUT' : 'POST';
break;
case 'locations':
endpoint = isEdit ? `/api/admin-locations/${editId}` : '/api/admin-locations';
endpoint = isEdit ? `/api/v1/admin/locations/${editId}` : '/api/v1/admin/locations';
successMessage = isEdit ? 'Standort erfolgreich aktualisiert' : 'Standort erfolgreich hinzugefügt';
method = isEdit ? 'PUT' : 'POST';
break;
case 'adminusers':
endpoint = isEdit ? `/api/admin-adminusers/${editId}` : '/api/admin-adminusers';
endpoint = isEdit ? `/api/v1/admin/adminusers/${editId}` : '/api/v1/admin/adminusers';
successMessage = isEdit ? 'Admin-Benutzer erfolgreich aktualisiert' : 'Admin-Benutzer erfolgreich hinzugefügt';
method = isEdit ? 'PUT' : 'POST';
break;
case 'runs':
endpoint = isEdit ? `/api/admin-runs/${editId}` : '/api/admin-runs';
endpoint = isEdit ? `/api/v1/admin/runs/${editId}` : '/api/v1/admin/runs';
successMessage = isEdit ? 'Lauf erfolgreich aktualisiert' : 'Lauf erfolgreich hinzugefügt';
method = isEdit ? 'PUT' : 'POST';
break;
@@ -697,7 +697,7 @@ async function editRun(id) {
async function deletePlayer(id) {
if (await confirmDelete(`Spieler mit ID ${id} löschen?`)) {
try {
const response = await fetch(`/api/admin-players/${id}`, { method: 'DELETE' });
const response = await fetch(`/api/v1/admin/players/${id}`, { method: 'DELETE' });
const result = await response.json();
if (result.success) {
@@ -716,7 +716,7 @@ async function deletePlayer(id) {
async function deleteRun(id) {
if (await confirmDelete(`Lauf mit ID ${id} löschen?`)) {
try {
const response = await fetch(`/api/admin-runs/${id}`, { method: 'DELETE' });
const response = await fetch(`/api/v1/admin/runs/${id}`, { method: 'DELETE' });
const result = await response.json();
if (result.success) {
@@ -735,7 +735,7 @@ async function deleteRun(id) {
async function deleteLocation(id) {
if (await confirmDelete(`Standort mit ID ${id} löschen?`)) {
try {
const response = await fetch(`/api/admin-locations/${id}`, { method: 'DELETE' });
const response = await fetch(`/api/v1/admin/locations/${id}`, { method: 'DELETE' });
const result = await response.json();
if (result.success) {
@@ -754,7 +754,7 @@ async function deleteLocation(id) {
async function deleteAdminUser(id) {
if (await confirmDelete(`Admin-Benutzer mit ID ${id} löschen?`)) {
try {
const response = await fetch(`/api/admin-adminusers/${id}`, { method: 'DELETE' });
const response = await fetch(`/api/v1/admin/adminusers/${id}`, { method: 'DELETE' });
const result = await response.json();
if (result.success) {