diff --git a/client/src/components/UserProfileContent.jsx b/client/src/components/UserProfileContent.jsx index 54862b5..3a313df 100644 --- a/client/src/components/UserProfileContent.jsx +++ b/client/src/components/UserProfileContent.jsx @@ -2,6 +2,7 @@ import { useDispatch, useSelector } from "react-redux"; import ProfileEdit from "../pages/user/ProfileEdit"; import toast, { Toaster } from "react-hot-toast"; import { setUpdated } from "../redux/user/userSlice"; +import { useEffect } from "react"; const UserProfileContent = () => { const { email, username, profilePicture, phoneNumber, adress } = useSelector( @@ -9,10 +10,13 @@ const UserProfileContent = () => { ); const dispatch = useDispatch(); const isUpdated = useSelector((state) => state.user.isUpdated); - if (isUpdated) { - toast.success("successfully updated"); - dispatch(setUpdated(false)); - } + + useEffect(() => { + if (isUpdated) { + toast.success("Successfully updated"); + dispatch(setUpdated(false)); + } + }, [isUpdated, dispatch]); return (
@@ -27,9 +31,9 @@ const UserProfileContent = () => { className="w-full h-full rounded-full object-center object-cover" />
- +
diff --git a/client/src/pages/admin/components/BookingsTable.jsx b/client/src/pages/admin/components/BookingsTable.jsx index 685fef7..ca6d190 100644 --- a/client/src/pages/admin/components/BookingsTable.jsx +++ b/client/src/pages/admin/components/BookingsTable.jsx @@ -3,7 +3,7 @@ import { DataGrid } from "@mui/x-data-grid"; import Box from "@mui/material/Box"; const BookingsTable = () => { - const [bookings, setBookings] = useState(""); + const [bookings, setBookings] = useState([]); const fetchBookings = async () => { try { @@ -126,8 +126,6 @@ const BookingsTable = () => { //rows const rows = - bookings && - bookings.length > 0 && bookings.map((cur) => ({ id: cur._id, bookingId: cur._id, diff --git a/client/src/pages/user/Orders.jsx b/client/src/pages/user/Orders.jsx index 008c3d1..d5e8cec 100644 --- a/client/src/pages/user/Orders.jsx +++ b/client/src/pages/user/Orders.jsx @@ -51,9 +51,9 @@ export default function Orders() {

Your Bookings

-

+

{bookings && bookings.length > 0 ? "Check out all of your Bookings" :
No Bookings Yet
} -

+
{bookings && bookings.length > 0 && bookings.map((cur, idx) => { diff --git a/client/src/pages/vendor/Components/VendorBookingTable.jsx b/client/src/pages/vendor/Components/VendorBookingTable.jsx index a9b8f9c..fc16e87 100644 --- a/client/src/pages/vendor/Components/VendorBookingTable.jsx +++ b/client/src/pages/vendor/Components/VendorBookingTable.jsx @@ -140,7 +140,7 @@ const VendorBookingsTable = () => {
-

+

{filtered && filtered.length > 0 ? ( "Check out all of your Bookings" ) : ( @@ -148,7 +148,7 @@ const VendorBookingsTable = () => { No Bookings Yet
)} -

+
{filtered && filtered.length > 0 &&