Ajout des fichiers de l'application

This commit is contained in:
Rampeur
2025-08-07 08:12:11 +02:00
parent 16fc6b69a6
commit 8da4b7cb28
193 changed files with 372196 additions and 0 deletions
@@ -0,0 +1,28 @@
"use server";
import { createApiClient } from "@/utils/api/apiClient";
import { getSession } from "@/utils/auth/session";
import { redirect } from "next/navigation";
export const deleteArticleAction = async (_prevState: undefined, slug: string) => {
if ((await getSession()) == null) {
redirect("/login");
}
const apiClient = createApiClient({
path: "/articles/{slug}",
method: "delete",
params: {
path: {
slug,
},
},
});
const response = await apiClient.sendRequest();
if (response.result === "success") {
redirect("/");
}
throw new Error("api error");
};