elemente statt todos in dashboard
All checks were successful
Build & Push Image / build-image (push) Successful in 1m27s

This commit is contained in:
2026-03-02 18:57:22 +09:00
parent 8965ffc11b
commit 5569f35037
3 changed files with 6 additions and 6 deletions

View File

@@ -12,8 +12,8 @@
<button id="logoutBtn">Logout</button>
<h2>Todos</h2>
<ul id="todosList"></ul>
<h2>Elemente</h2>
<ul id="elementsList"></ul>
<p id="errorMessage" class="error"></p>
</div>

View File

@@ -21,11 +21,11 @@ logoutBtn.addEventListener("click", () => {
});
// Lade Todos vom Backend
async function loadTodos() {
async function loadElements() {
try {
const res = await authFetch("/todos"); // fetchWrapper sendet den JWT Automatisch
const res = await authFetch("/elements"); // fetchWrapper sendet den JWT Automatisch
if (!res.ok) {
errorMessage.textContent = "Fehler beim Abrufen der Todos!";
errorMessage.textContent = "Fehler beim Abrufen der Elemente!";
if (res.status === 401) {
window.location.href = "login.html"; // bei ungültigem Token zum Login
}

View File

@@ -3,7 +3,7 @@ import prisma from '../prismaClient.js'
const router = express.Router()
router.get('/', async (req, res) => {
router.get('/elements', async (req, res) => {
try {
// Versuche es mit exakt dem Namen aus deinem Schema (Elements)
const data = await prisma.Elements.findMany();