From f2da7d7124647d334aefdc54b3860d857cc698ce Mon Sep 17 00:00:00 2001 From: Maxime Quandalle Date: Thu, 22 Aug 2024 16:27:50 +0200 Subject: [PATCH] filtre les messages de retour utilisateur --- src/routes/api/post-feedback/+server.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/routes/api/post-feedback/+server.js b/src/routes/api/post-feedback/+server.js index bd40494..479a63a 100644 --- a/src/routes/api/post-feedback/+server.js +++ b/src/routes/api/post-feedback/+server.js @@ -18,6 +18,10 @@ export async function POST({ request }) { return new Response(undefined, { status: 500 }); } + if (message.length < 5) { + return new Response('Le message doit contenir au moins 5 caractères', { status: 400 }); + } + const res = await fetch('https://api.github.com/repos/mquandalle/mesaidesvelo-feedback/issues', { method: 'POST', headers: {