Dienstellen Selektion raus aus Admin
This commit is contained in:
Binary file not shown.
@@ -23,7 +23,7 @@
|
||||
let dienststellen: any[];
|
||||
|
||||
onMount(async () => {
|
||||
const res = await fetch('/api/admin/dienststellen');
|
||||
const res = await fetch('/api/dienststellen');
|
||||
dienststellen = await res.json();
|
||||
});
|
||||
|
||||
|
||||
10
src/routes/api/dienststellen/+server.ts
Normal file
10
src/routes/api/dienststellen/+server.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
import { json } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
export const GET: RequestHandler = async () => {
|
||||
const dienststellen = await prisma.dienststelle.findMany({ orderBy: { name: 'asc' } });
|
||||
return json(dienststellen);
|
||||
};
|
||||
Reference in New Issue
Block a user