Backend: rediriger vers la fiche apres creation d'un adherent

Le login et le mot de passe temporaire s'affichent sur la fiche de
l'adherent. Apres creation, AddMemberPanel redirige desormais vers
/backend/adherents/[id] pour les rendre visibles immediatement.
addMember retourne l'id du nouvel adherent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Opus 4.8 committed 2026-06-27 10:03:48 +02:00
1 parent 4193d8e914
commit e2dc695d3e
2 files changed
+8 -3

No files matched your search

+3 -2
View File
@@ -114,12 +114,12 @@ export async function publishPromo(formData: FormData) {
}
// ---- Members CRUD ----
export async function addMember(formData: FormData) {
export async function addMember(formData: FormData): Promise<number | undefined> {
const { role } = await requireRole();
if (!can(role, "manageMembers")) throw new Error("Accès refusé");
const name = String(formData.get("name") ?? "").trim();
if (!name) return;
if (!name) return undefined;
const email = String(formData.get("email") ?? "").trim().toLowerCase();
if (!email) throw new Error("L'e-mail est requis pour créer le compte de l'adhérent.");
const categoryId = formData.get("categoryId") ? Number(formData.get("categoryId")) : null;
@@ -154,6 +154,7 @@ export async function addMember(formData: FormData) {
revalidatePath("/backend/adherents");
revalidatePath("/backend");
revalidatePath("/");
return newMember.id;
}
// Crée des comptes de connexion pour les adhérents existants qui n'en ont pas