diff --git a/client/src/Steps/Service.jsx b/client/src/Steps/Service.jsx index 857e838..224f20b 100644 --- a/client/src/Steps/Service.jsx +++ b/client/src/Steps/Service.jsx @@ -6,9 +6,12 @@ import img from "../assests/service.png"; import { Link } from "react-router-dom"; import { useBooking } from "../contexts/BookingDataContext"; import { message } from "antd"; +import axios from "axios"; +import NoRIdeAvailable from "../pages/NoRIdeAvailable"; const Service = () => { const location = useLocation(); const [selectedService, setSelectedService] = useState(null); + const [value, setValue] = useState(false); const [user, setUser] = useState(null); const { dispatch } = useUser(); const { fetch } = useBooking(); @@ -35,14 +38,25 @@ const Service = () => { duration: 8, }, ]; - - console.log(localStorage.getItem("ShowUi")); + const getBooleanValue = async () => { + try { + const res = await axios.get( + `${process.env.REACT_APP_SECRETROUTE}/getBooleanValue` + ); + localStorage.setItem("ShowUi", res.data.booleanValue); + setValue(res.data.booleanValue); + } catch (error) { + console.log(error); + } + }; const handleServiceSelect = (service) => { setSelectedService(service); fetch({ type: "UPDATE_STEP1", payload: service }); message.success("Service Selected"); }; useEffect(() => { + // get the value of the show ui or not + getBooleanValue(); // Create a flag to track whether the effect has already run let isMounted = true; @@ -81,43 +95,51 @@ const Service = () => { > ) : ( <> -
- Price - {service.price} -
-- Security - {service.securtiy} -
+ {!value ? ( + <> ++ Price - {service.price} +
++ Security - {service.securtiy} +
+