Skip to content

Commit f1a681f

Browse files
committed
fixed all error messages more than 80 error handelings)
1 parent 943e6ff commit f1a681f

File tree

73 files changed

+174
-126
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+174
-126
lines changed

client/app/auth/change-password/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { Input } from "@/components/ui/input";
1313
import { Label } from "@/components/ui/label";
1414
import useChangePass from "@/hooks/auth/useChangePass";
1515
import { setCookie } from "@/lib/cookieFunctions";
16+
import { message } from "antd";
1617
import Link from "next/link";
1718
import { useRouter } from "next/navigation";
1819
import { useEffect, useState } from "react";
@@ -34,7 +35,7 @@ export default function ChangePassword() {
3435
setTime((time) => {
3536
if (time === 0) {
3637
clearInterval(timer);
37-
alert("Time Expired!");
38+
message.error("Time Expired!");
3839
router.push("/dashboard");
3940
return 0;
4041
} else return time - 0.5;
@@ -45,7 +46,7 @@ export default function ChangePassword() {
4546
async function submitForm() {
4647

4748
isVerified && (await changePass()) && router.push("/dashboard");
48-
!isVerified && alert("Invalid Captcha!");
49+
!isVerified && message.error("Invalid Captcha!");
4950
}
5051

5152
return (

client/app/auth/reset-password/initiate/forgetPasswordInitiate.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { useRouter } from "next/navigation";
99
import useForgetPassInitiate from "@/hooks/auth/useForgetPassInitiate";
1010
import { useContext, useState } from "react";
1111
import ReCAPTCHA from "react-google-recaptcha";
12+
import { message } from "antd";
1213

1314
function ForgetPassInitiateForm() {
1415
const { userEmail, setUserEmail, initiate } = useForgetPassInitiate();
@@ -18,7 +19,7 @@ function ForgetPassInitiateForm() {
1819
async function handleFormSubmit(e: React.FormEvent<HTMLFormElement>) {
1920
e.preventDefault();
2021
if (!isCaptchaVerified) {
21-
alert("Please verify that you are not a robot.");
22+
message.warning("Please verify that you are not a robot.");
2223
return;
2324
}
2425
const success = await initiate();

client/components/dashboard-componenets/mainContent/landFillManagerContents/Storage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ export default function LandfillManagerStorageData() {
2323
getLandfillDatabyID(getCookie(landfillId))
2424
}, []);
2525

26-
useEffect(() => {
27-
// alert(JSON.stringify(landfillData))
26+
useEffect(() => {
2827
}, [landfillData]);
2928

3029
return (

client/components/dashboard-componenets/mainContent/stsManagerContents/Dashboard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ export default function STSManagerDashboard() {
1818
getstsDatabyID(getCookie(stsId));
1919
}, []);
2020

21-
useEffect(() => {
22-
// alert(JSON.stringify(stsData))
21+
useEffect(() => {
2322
}, [stsData]);
2423

2524
return (

client/components/dashboard-componenets/mainContent/stsManagerContents/DumpEntry.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default function STSManagerDumpEntries() {
2020
}, []);
2121

2222
useEffect(() => {
23-
// alert(JSON.stringify(stsData))
23+
2424
}, [stsData]);
2525

2626
return (

client/components/dashboard-componenets/mainContent/stsManagerContents/Storage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function STSManagerStorageData() {
2424
}, []);
2525

2626
useEffect(() => {
27-
// alert(JSON.stringify(stsData))
27+
2828
}, [stsData]);
2929

3030
return (

client/components/lists/PermissonList.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
import { Button } from "../ui/button";
2121
import { updatePermisson } from "@/hooks/user_data/updatePermisson";
2222
import { Pointer, SquareMousePointer } from "lucide-react";
23+
import { message } from "antd";
2324

2425
type RolesWithPermisson = {
2526
id: string;
@@ -175,7 +176,7 @@ function PermissonList() {
175176
<AlertDialogCancel>Cancel</AlertDialogCancel>
176177
<AlertDialogAction
177178
onClick={async () => {
178-
msg && alert(await updatePermisson(msg));
179+
msg && message.info(await updatePermisson(msg));
179180
await fetchAllRoles();
180181
setMsg(undefined);
181182
}}

client/components/modals/DeleteVehicleModalForSTS.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import React, { useState } from "react";
1515
import { Trash } from "lucide-react";
1616
import deleteUser from "@/hooks/user_data/deleteUser";
1717
import deleteVehicleEntryFromSTS from "@/hooks/StsDashboard/deleteVehicleEntryFromSTS";
18+
import { message } from "antd";
1819

1920
type Vehicle = {
2021
entryId: string,
@@ -90,9 +91,9 @@ export const DeleteVehicleModalForSTS = ({ vehicleInfo }: { vehicleInfo: Vehicle
9091
type="submit"
9192
onClick={async () => {
9293
if (confirmText !== "CONFIRM")
93-
return alert("Please type 'CONFIRM' to confirm");
94+
return message.error("Please type 'CONFIRM' to confirm");
9495
const result = await deleteVehicleEntryFromSTS(vehicleInfo.entryId);
95-
if (result) return alert(result);
96+
if (result) return message.info(result);
9697
}}
9798
>
9899
Confirm

client/components/modals/LandFillVehicleEntryModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import useTripComplete from "@/hooks/landFillDashboard/useTripComplete";
3838
import DatePicker from "react-datepicker";
3939

4040
import "react-datepicker/dist/react-datepicker.css";
41+
import { message } from "antd";
4142

4243

4344
type Vehicle = {
@@ -84,7 +85,7 @@ const handleDateChange = (date: Date) => {
8485
weightOfWaste: weightOfWaste,
8586
entryTime: selectedDateTime.toISOString()//entryTime,
8687
});
87-
if(postEntry) return alert(postEntry);
88+
if(postEntry) return message.success(postEntry);
8889

8990
} catch (error) {
9091
console.error("Error:", error);

client/components/modals/ProfileEditModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import useTripComplete from "@/hooks/landFillDashboard/useTripComplete";
3737
import { profile } from "console";
3838
import useEditProfileInfo from "@/hooks/user_data/useEditProfileInfo";
3939
import useGetUserProfile from "@/hooks/user_data/useGetUserProfile";
40+
import { message } from "antd";
4041

4142

4243
type User = {
@@ -73,7 +74,7 @@ export const ProfileEditModal = ({ profileInfo }: { profileInfo: User }) => {
7374
profileName: profilename
7475
});
7576

76-
if(postEntry) return alert(postEntry);
77+
if(postEntry) return message.success(postEntry);
7778

7879
} catch (error) {
7980
console.error("Error:", error);

0 commit comments

Comments
 (0)