From d86d86c9cebdff9498e47c8bc70c55963e4c9221 Mon Sep 17 00:00:00 2001 From: Sheng Tao Date: Sun, 21 May 2023 18:32:48 +0200 Subject: [PATCH 1/4] removed console log and unnecessary state --- frontend/pages/admin/data/buildings/edit.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/pages/admin/data/buildings/edit.tsx b/frontend/pages/admin/data/buildings/edit.tsx index 27feeb98..0677036c 100644 --- a/frontend/pages/admin/data/buildings/edit.tsx +++ b/frontend/pages/admin/data/buildings/edit.tsx @@ -35,7 +35,6 @@ function AdminDataBuildingsEdit() { const [regionId, setRegionId] = useState(-1); //used for collecting the right id to post/patch const [syndicId, setSyndicId] = useState(-1); //used for collecting the right id to post/patch const [manual, setManual] = useState(null); - // const [duration, setDuration] = useState("00:00"); const [publicId, setPublicId] = useState(""); const [validated, setValidated] = useState(false); const [durationInMinutes, setDurationInMinutes] = useState(0); @@ -124,7 +123,6 @@ function AdminDataBuildingsEdit() { setPostalCode(res.data.postal_code); setCity(res.data.city); setName(res.data.name ? res.data.name : ""); - console.log(res.data.duration); setDurationInMinutes(durationToMinutes(res.data.duration)); setPublicId(res.data.public_id ?? ""); const region = await getRegion(res.data.region); From fbbbb44d8bd60b5da3991d9c754dad0225d8928e Mon Sep 17 00:00:00 2001 From: GashinRS Date: Sun, 21 May 2023 16:35:28 +0000 Subject: [PATCH 2/4] Auto formatted code --- frontend/pages/admin/data/buildings/edit.tsx | 82 ++++++++++---------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/frontend/pages/admin/data/buildings/edit.tsx b/frontend/pages/admin/data/buildings/edit.tsx index 0677036c..c3f23a34 100644 --- a/frontend/pages/admin/data/buildings/edit.tsx +++ b/frontend/pages/admin/data/buildings/edit.tsx @@ -1,8 +1,9 @@ -import React, {ChangeEvent, useEffect, useState} from "react"; -import {useRouter} from "next/router"; -import {Button, Col, Container, Form, Row} from "react-bootstrap"; +import React, { ChangeEvent, useEffect, useState } from "react"; +import { useRouter } from "next/router"; +import { Button, Col, Container, Form, Row } from "react-bootstrap"; import { - deleteBuildingComment, durationToMinutes, + deleteBuildingComment, + durationToMinutes, getBuildingComment, getBuildingInfo, getDurationFromMinutes, @@ -11,17 +12,17 @@ import { postBuilding, postBuildingComment, } from "@/lib/building"; -import {getRegion} from "@/lib/region"; -import {getUserInfo} from "@/lib/user"; +import { getRegion } from "@/lib/region"; +import { getUserInfo } from "@/lib/user"; import AdminHeader from "@/components/header/adminHeader"; -import {withAuthorisation} from "@/components/withAuthorisation"; +import { withAuthorisation } from "@/components/withAuthorisation"; import RegionAutocomplete from "@/components/autocompleteComponents/regionAutocomplete"; import PDFUploader from "@/components/pdfUploader"; import ErrorMessageAlert from "@/components/errorMessageAlert"; import ConfirmationMessage from "@/components/confirmMessage"; import SyndicAutocomplete from "@/components/autocompleteComponents/syndicAutocomplete"; -import {handleError} from "@/lib/error"; -import {postManual} from "@/lib/building-manual"; +import { handleError } from "@/lib/error"; +import { postManual } from "@/lib/building-manual"; function AdminDataBuildingsEdit() { const requiredFieldsNotFilledMessage = "Gelieve alle verplichte velden (*) in te vullen."; @@ -97,7 +98,7 @@ function AdminDataBuildingsEdit() { } } if (manual) { - await postManual({building: buildingId, file: manual}); + await postManual({ building: buildingId, file: manual }); } setShowConfirmation(true); } catch (error: any) { @@ -150,19 +151,18 @@ function AdminDataBuildingsEdit() { return (
- - + +
- +

Bewerk gebouw

- + Gebouw naam ) => setPostalCode(e.target.value)} required /> - Vul een postcode - in. + Vul een postcode in. @@ -228,9 +227,9 @@ function AdminDataBuildingsEdit() { onChange={(e: ChangeEvent) => setBusNumber(e.target.value)} /> - + - +

Klantennummer afvalophaaldienst @@ -242,8 +241,7 @@ function AdminDataBuildingsEdit() { /> - Publieke identificatie (voor - bewoners) + Publieke identificatie (voor bewoners) - Duur van een ronde (in - minuten)* + Duur van een ronde (in minuten)* Opmerkingen ) => setBuildingComments(e.target.value)} /> -
- -

- +

+ +

+

-
- -
From ea3c857a68cd0148b932e12c64576124cf43e87a Mon Sep 17 00:00:00 2001 From: Simon Van den Bussche Date: Sun, 21 May 2023 18:43:23 +0200 Subject: [PATCH 3/4] remove console.error --- .../autocompleteComponents/autocompleteComponent.tsx | 2 +- frontend/components/password/resetPassword.tsx | 1 - frontend/lib/student-on-tour.ts | 6 +----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/frontend/components/autocompleteComponents/autocompleteComponent.tsx b/frontend/components/autocompleteComponents/autocompleteComponent.tsx index 39000eb1..46802cc1 100644 --- a/frontend/components/autocompleteComponents/autocompleteComponent.tsx +++ b/frontend/components/autocompleteComponents/autocompleteComponent.tsx @@ -78,7 +78,7 @@ const AutocompleteComponent: React.FC = ({ setInputValue(initialOption.label); } } catch (err) { - console.error(err); + } } diff --git a/frontend/components/password/resetPassword.tsx b/frontend/components/password/resetPassword.tsx index 5939b2d1..584b07ce 100644 --- a/frontend/components/password/resetPassword.tsx +++ b/frontend/components/password/resetPassword.tsx @@ -20,7 +20,6 @@ function ResetPassword() { event.preventDefault(); // Handle the reset password process here - console.log("Reset password"); }; return ( diff --git a/frontend/lib/student-on-tour.ts b/frontend/lib/student-on-tour.ts index fbb1c399..65e3cdac 100644 --- a/frontend/lib/student-on-tour.ts +++ b/frontend/lib/student-on-tour.ts @@ -146,9 +146,7 @@ export function studentOnTourSearchString(studentOnTour: StudentOnTour) { const tour: Tour = res.data; return `${tour.name} (${studentOnTour.date})`; }, - (err) => { - console.error(err); - } + () => {} ); } @@ -184,8 +182,6 @@ export async function getActualToursOfStudent( }; } catch (err) { - // Handle any errors that occurred while fetching data - console.error(err); throw err; } } From 3fa122d3ad49d4b9743b92cd83e15eb5338c6daa Mon Sep 17 00:00:00 2001 From: simvadnbu Date: Sun, 21 May 2023 16:44:12 +0000 Subject: [PATCH 4/4] Auto formatted code --- .../autocompleteComponents/autocompleteComponent.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/frontend/components/autocompleteComponents/autocompleteComponent.tsx b/frontend/components/autocompleteComponents/autocompleteComponent.tsx index 46802cc1..358d185b 100644 --- a/frontend/components/autocompleteComponents/autocompleteComponent.tsx +++ b/frontend/components/autocompleteComponents/autocompleteComponent.tsx @@ -77,9 +77,7 @@ const AutocompleteComponent: React.FC = ({ setValue(initialOption); setInputValue(initialOption.label); } - } catch (err) { - - } + } catch (err) {} } fetch().then();