diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 8dd8c75..9e038e0 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -6,18 +6,20 @@ import LoginPage from './pages/auth'; import { HomePage } from './pages/home'; import { ProfilPage } from './pages/profil'; import { ShotgunPage } from './pages/shotgun'; -import { AdminPageRole, - AdminPageTeam, - AdminPageEvents, - AdminPageExport, - AdminPageFaction, - AdminPagePerm, - AdminPageChall, - AdminPageEmail, - AdminPageUser, - AdminPageNews, - AdminPageGames, - AdminPageTent} from './pages/admin'; +import { + AdminPageRole, + AdminPageTeam, + AdminPageEvents, + AdminPageExport, + AdminPageFaction, + AdminPagePerm, + AdminPageChall, + AdminPageEmail, + AdminPageUser, + AdminPageNews, + AdminPageGames, + AdminPageTent +} from './pages/admin'; import ProtectedRoute from './components/utils/protectedroute'; import AdminRoute from './components/utils/adminroute'; @@ -29,7 +31,7 @@ import { ResetPasswordPage } from './pages/resetPassword' import { WeiPage } from './pages/wei'; import { SdiPage } from './pages/sdi'; import { NewsPage } from './pages/news'; -import {DiscordPage} from './pages/discord'; +import { DiscordPage } from './pages/discord'; import PrivateRoute from './components/utils/privateroute'; import { GamesPage } from './pages/games'; import { FoodPage } from './pages/food'; diff --git a/frontend/src/components/Admin/AdminPerm/adminPermForm.tsx b/frontend/src/components/Admin/AdminPerm/adminPermForm.tsx index d9e4e93..d68a57a 100644 --- a/frontend/src/components/Admin/AdminPerm/adminPermForm.tsx +++ b/frontend/src/components/Admin/AdminPerm/adminPermForm.tsx @@ -69,13 +69,22 @@ const PermanenceForm = ({ }, [editMode, editPermanence]); const handleSubmit = async () => { - if (!name || !desc || !location || !startAt || !endAt || !capacity || !difficulty) { + if ( + !name || + !desc || + !location || + !startAt || + !endAt || + !capacity || + !difficulty + ) { Swal.fire("Erreur", "Veuillez remplir tous les champs", "warning"); return; } - let respoId = respo && !isNaN(Number(respo.userId)) ? Number(respo.userId) : null; - + const respoId = + respo && !isNaN(Number(respo.userId)) ? Number(respo.userId) : null; + try { const payload = { name, @@ -99,7 +108,7 @@ const PermanenceForm = ({ resetForm(); onRefresh(); - } catch(err : any) { + } catch (err: any) { Swal.fire("Erreur", err.response.data.message, "error"); } }; @@ -121,31 +130,61 @@ const PermanenceForm = ({ })); const selectedRespoOption = respo - ? { value: respo.userId, label: `${respo.firstName} ${respo.lastName}` } - : null; - - + ? { value: respo.userId, label: `${respo.firstName} ${respo.lastName}` } + : null; return (
- setName(e.target.value)} /> -