Skip to content

Commit 785f3cd

Browse files
fix product page
1 parent 6ba3285 commit 785f3cd

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/component/productDetails/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import styles from "./productDetails.module.scss";
1515
import { useRouter } from "next/router";
1616

1717
const ProductDetails: FC<productDetailsProps> = ({ product }) => {
18-
// const router = useRouter();
19-
// const locale = router.locale || "en";
2018
const { data: featuredProduct = [] } = useQuery({
2119
queryKey: ["featuredProduct"],
2220
queryFn: async () => {

src/component/productInfo/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { productInfoProps } from "./productInfo.types";
1010

1111
import styles from "./productInfo.module.scss";
1212
import { useFetchProductData } from "@/utils/hooks/api/useFetchProductData";
13+
import { useRouter } from "next/router";
1314

1415
const ProductInfo: FC<productInfoProps> = ({
1516
id,
@@ -22,17 +23,16 @@ const ProductInfo: FC<productInfoProps> = ({
2223
const [selectedOption, setSelectedOption] = useState<
2324
{ id: string; value: string }[]
2425
>([]);
26+
const router = useRouter();
27+
const locale = router.locale || "en";
2528
const { addToCart, isLoading } = useCart();
2629
const [quantity, setQuantity] = useState(1);
2730

28-
const {
29-
data: productData,
30-
isFetching,
31-
isError,
32-
} = useFetchProductData({
31+
const { data: productData } = useFetchProductData({
3332
productId: id,
3433
selectedOption,
3534
refresh: true,
35+
locale: locale,
3636
});
3737

3838
const handleSelectOption = (id: string, value: string) => {

0 commit comments

Comments
 (0)