"use server" import { ProConAnzeige, ProConAnzeigeVisuElement } from "@/types/procon/anzeigen"; const url = "http://localhost:3000/procon/"; const url_anzeigen = url + "anzeigen" //----------------------------------------------------------------------------- //--- Anzeigen //----------------------------------------------------------------------------- export async function api_ProconAnzeigen(): Promise { const result = await fetch(`${url_anzeigen}`, { method: 'GET', headers: { 'Content-Type': 'application/json' } }); const data = await result.json(); return orderByDatenNummer(data); } export async function api_ProconAnzeige_byId(id:number): Promise { const result = await fetch(`${url_anzeigen}/byId/${id}`, { method: 'GET', headers: { 'Content-Type': 'application/json' } }); const data = await result.json(); return data; } export async function api_ProconAnzeige_byDatenNumber(id:number): Promise { const result = await fetch(`${url_anzeigen}/byDatenNummer/${id}`, { method: 'GET', headers: { 'Content-Type': 'application/json' } }); const data = await result.json(); return data; } //--- Visu Elemente export async function api_ProconAnzeige_visuElements(id:number): Promise { const result = await fetch(`${url_anzeigen}/VisuElements/${id}`, { method: 'GET', headers: { 'Content-Type': 'application/json' } }); const data = await result.json(); return data; } function orderByDatenNummer(data:ProConAnzeige[]) { return data.sort((a,b)=>a.DatenNummer-b.DatenNummer) }