mirror of
https://github.com/R0m1k3/PleinR.git
synced 2026-10-23 07:08:05 +02:00
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:
1 parent
4193d8e914
commit
e2dc695d3e
2 files changed
+8
-3
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user