Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hel 509/search history #349

Merged
merged 26 commits into from
Aug 21, 2023
Merged

Hel 509/search history #349

merged 26 commits into from
Aug 21, 2023

Conversation

schlaifa
Copy link
Contributor

@schlaifa schlaifa commented Aug 8, 2023

Vérifier avant de merger

  • As-tu correctement relu ton code ?
  • As-tu besoin de revoir ton ticket avec la PO ou UX ?
  • Faut-il rajouter une nouvelle date de mise à jour sur la production ?
  • Faut-il rajouter des données dans data_set ?
  • Faut-il ajouter des variables d'environnement sur la production ?
  • Faut-il mettre à jour middleware.ts et lighthouserc.js dû à la création/suppression d'une page ?
  • Faut-il modifier Content-Security-Policy dans next.config.js ?

import { SearchHistoryPage } from "../frontend/ui/search-history/SearchHistoryPage";

export default function Favoris() {
useBreadcrumb([]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add breadcrumb

import { FavorisPage } from "../frontend/ui/favoris/FavorisPage";

export default function Favoris() {
useBreadcrumb([]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add breadcrumb

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file name "add"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filename "get"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filename "remove"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filename "get"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filename "add"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il manque peut etre la réponse 500 s'il y a une erreur quelque part avec un try catch

})
.then((response) => response.json())
.then((data) => {
var formattedHistory: SearchHistoryView[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utiliser let à la place de var

.then((response) => response.json())
.then((data) => {
var formattedHistory: SearchHistoryView[] = [];
data.map((elt: any) => {
Copy link
Contributor

@nbenyahiadev nbenyahiadev Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data.map retourne un tableau, tu peut utiliser ce tableau et le set dans setSearchHistory
const formattedHistory = data.map(elt => ({ title: ..., date: ..., finessNumber: ..., type: ... });



const handleFavoriteStatus = async () => {
const filtredFavoris = userContext?.favoris.filter((item) => item.numéroFiness === favorite?.numéroFiness);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

table favoris only one call

})
.then((response) => response.json())
.then((data) => {
var favorisViewModel: RechercheViewModel[] = [];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

traitement avec map

import styles from "./Recherche.module.css";

type EstablishmentProps = Readonly<{
résultatViewModel: any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replace by recherche view model

@@ -47,6 +48,8 @@ export default NextAuth({
return token
},
async session({ session, token }) {
session.user.idUser = token['idUser'] as string;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove space

if (request.method !== "POST") {
return response.status(405).send("Method not allowed");
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add try catch with 500 response in catch

if (request.method !== "GET") {
response.status(405).send("Method not allowed");
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add try catch with 500 response in catch

if (request.method !== "POST") {
response.status(405).send("Method not allowed");
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add try catch with 500 response in catch

if (request.method !== "POST") {
return response.status(405).send("Method not allowed");
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add try catch with 500 response in catch

if (request.method !== "GET") {
response.status(405).send("Method not allowed");
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add try catch with 500 response in catch

@@ -18,16 +22,35 @@ type RouterProps = Readonly<{
export default function Router({ entitéJuridique, établissementsTerritoriauxRattachés }: RouterProps) {
const { wording } = useDependencies();

const { rechercher, résultats } = useRecherche();
const [rechercheViewModel, setRechercheViewModel] = useState<RechercheViewModel>();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get data in getStaticProps function

@schlaifa schlaifa merged commit f7dd2d0 into develop Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants