From 7d9c4c197e5dd70379d16c98f186835fe6709297 Mon Sep 17 00:00:00 2001 From: Benjamin POCHAT Date: Mon, 11 Nov 2024 13:22:53 +0100 Subject: [PATCH] =?UTF-8?q?Une=20erreur=20appara=C3=AEt=20quand=20on=20ess?= =?UTF-8?q?aie=20d'acc=C3=A9der=20=C3=A0=20une=20page=20qui=20n=C3=A9cessi?= =?UTF-8?q?te=20une=20authent=20si=20l'utilisateut=20n'est=20pas=20authent?= =?UTF-8?q?ifi=C3=A9=20#46?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../registration/RegistrationsService.java | 2 +- frontend/app/src/layouts/ErrorLayout.tsx | 30 +++++++++++++++++-- .../customer/CustomerRouterFactory.tsx | 2 ++ .../producer/ProducerRouterFactory.tsx | 7 +++-- 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/backend/app/src/main/java/eu/viandeendirect/domains/registration/RegistrationsService.java b/backend/app/src/main/java/eu/viandeendirect/domains/registration/RegistrationsService.java index f58be7e..5095f26 100644 --- a/backend/app/src/main/java/eu/viandeendirect/domains/registration/RegistrationsService.java +++ b/backend/app/src/main/java/eu/viandeendirect/domains/registration/RegistrationsService.java @@ -60,7 +60,7 @@ public ResponseEntity processRegistration(Registration registration) { Description de la production :
%s
- + """, registration.getProducer().getUser().getFirstName(), registration.getProducer().getUser().getLastName(), diff --git a/frontend/app/src/layouts/ErrorLayout.tsx b/frontend/app/src/layouts/ErrorLayout.tsx index 49dc26e..296223e 100644 --- a/frontend/app/src/layouts/ErrorLayout.tsx +++ b/frontend/app/src/layouts/ErrorLayout.tsx @@ -1,6 +1,32 @@ -import { Typography } from "@mui/material"; +import { AppBar, Box, CssBaseline, Toolbar, Typography } from "@mui/material"; import React from "react"; +import { useRouteError } from "react-router-dom"; export function ErrorLayout({message: message}) { - return {message} + + return ( + + + theme.zIndex.drawer + 1, + }} + > + + + Viande en direct + + + + + + Oups... y a un soucis :( + {message} + N'hésitez pas à nous signaler le problème + Signaler le problème à la.viande.en.direct@gmail.com + Revenir à la page d'accueil + + + ) } diff --git a/frontend/app/src/layouts/customer/CustomerRouterFactory.tsx b/frontend/app/src/layouts/customer/CustomerRouterFactory.tsx index c57e754..7f5ae7f 100644 --- a/frontend/app/src/layouts/customer/CustomerRouterFactory.tsx +++ b/frontend/app/src/layouts/customer/CustomerRouterFactory.tsx @@ -8,6 +8,7 @@ import CustomerCreationForm, { loadCustomerCreationFormData } from "../../domain import NotAuthorizedForProducers, { loadNotAuthorizedForProducerData } from "../../authentication/views/NotAuthorizedForProducers.tsx"; import Welcome, { loadWelcomeData } from "../../domains/welcome/Welcome.tsx"; import PaymentLayout from "./PaymentLayout.tsx"; +import { ErrorLayout } from "../ErrorLayout.tsx"; export class CustomerRouterFactory { getRouter(keycloak) { @@ -16,6 +17,7 @@ export class CustomerRouterFactory { path: "/", element: , loader: async () => loadCustomerLayoutData(keycloak), + errorElement: , children: [ { index: true, diff --git a/frontend/app/src/layouts/producer/ProducerRouterFactory.tsx b/frontend/app/src/layouts/producer/ProducerRouterFactory.tsx index 5e21d54..43c07b0 100644 --- a/frontend/app/src/layouts/producer/ProducerRouterFactory.tsx +++ b/frontend/app/src/layouts/producer/ProducerRouterFactory.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { createBrowserRouter, Navigate } from "react-router-dom"; +import { createBrowserRouter, Navigate, useRouteError } from "react-router-dom"; import AuthenticatedLayout, { loadAuthenticatedLayoutData } from "./AuthenticatedLayout.tsx"; @@ -18,6 +18,7 @@ import ProducerOrderForm, { loadProducerOrderFormData } from "../../domains/sale import CustomersList, { loadCustomersListData } from "../../domains/customer/views/CustomersList.tsx"; import PublicationBeefProductionToSale, { loadPublicationBeefProductionToSaleData } from "../../domains/production/views/beefProduction/PublicationBeefProductionToSale.tsx"; import RegistrationForm from "./RegistrationForm.tsx"; +import { ErrorLayout } from "../ErrorLayout.tsx"; export class ProducerRouterFactory { getRouter(keycloak) { @@ -26,6 +27,7 @@ export class ProducerRouterFactory { path: "/", element: , loader: async () => loadAuthenticatedLayoutData(keycloak), + errorElement: , children: [ { index: true, @@ -108,5 +110,4 @@ export class ProducerRouterFactory { ]) } - -} \ No newline at end of file +}