diff --git a/src/layout/index.tsx b/src/layout/index.tsx index 4d10a8d..2bc1339 100644 --- a/src/layout/index.tsx +++ b/src/layout/index.tsx @@ -6,10 +6,14 @@ import { Helmet } from "react-helmet-async"; import { useEffect } from "react"; import { useDispatch } from "react-redux"; import { setConfigId } from "../redux/slices/configId"; +import { setShopId } from "../redux/slices/shop-id"; // import toast from "react-hot-toast"; const Layout = () => { const { configs } = useParams<{ configs: string }>(); + + const shopId = new URLSearchParams(window.location.search).get("shop_id"); + const dispatch = useDispatch(); useEffect(() => { if (configs === "1" || configs === "2" || configs === "3") { @@ -26,6 +30,12 @@ const Layout = () => { }, 100); // Scroll to 100% of the page height }, [configs, dispatch]); + useEffect(() => { + if (shopId) { + dispatch(setShopId(shopId)); + } + }, [shopId, dispatch]); + // useEffect(() => { // toast.custom( // (t) => (