elemente statt todos in dashboard
All checks were successful
Build & Push Image / build-image (push) Successful in 1m27s
All checks were successful
Build & Push Image / build-image (push) Successful in 1m27s
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user