stand2026_10_06

This commit is contained in:
marco committed 2026-10-06 15:34:27 +02:00
1 parent 41f80ce947
commit 266f8c3b4f
199 files changed
+17061 -87

No files matched your search

+64
View File
@@ -0,0 +1,64 @@
'use server'
import { Sites } from "@/_config/sites";
import { VisuElement, VisuElementCreate, VisuElementUpdate } from "@/types/visu/visuElements.types";
import { revalidatePath } from "next/cache";
export async function api_VisuElementsAll(): Promise<VisuElement[]> {
const result = await fetch(`http://localhost:3000/visu-elements`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' }
});
const data = await result.json() as VisuElement[];
return data;
}
export async function api_VisuElementCreate(data: VisuElementCreate): Promise<ActionResult<VisuElement>> {
const result = await fetch(`http://localhost:3000/visu-elements/`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json();
if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.visu.url);
return { success: true };
}
export async function api_VisuElementUpdate(id: string, data: VisuElementUpdate): Promise<ActionResult<VisuElement>> {
const result = await fetch(`http://localhost:3000/visu-elements/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data),
})
const resultData = await result.json();
if (!result.ok) {
return {
success: false,
errors: resultData.message, // kommt aus NestJS
};
}
revalidatePath(Sites.visu.url);
return { success: true };
}