Skip to content

Commit ed7b786

Browse files
committed
[Auto Generated]
1 parent 281c2a6 commit ed7b786

File tree

9 files changed

+22
-16
lines changed

9 files changed

+22
-16
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/page-layouts/plp/Components/add-to-cart/add-to-cart.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pages/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pages/product-listing/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pages/product-listing/product-listing.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pages/wishlist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pages/wishlist/wishlist.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github_app_jwt.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NzM3NzMwMjMsImV4cCI6MTc3Mzc3MzU5MywiaXNzIjoiMzA1NjEyNSJ9.MowOObXiXR9M8FhsBKl-maRGyfQgEiytJCletBBXHBzjl6N_oMinjgnrSfBycvQAP0W10wZL98P5A8mcJ7uBFY_16RtvQV0ZBJ7bZx5QLLb2i7ZxstiR5Iqf0nXp7t5wMQ24eodyIRDf0NDmFYsZ_Nmnv3GjzO4-Yxfc9qSKyDbLc8iyBENVmGkYvFeB5G3qU3vBL8Ii2vyZnNJUftTBLX0TqqGBJEXFZZ_VuLLi5mWxF21GV-GLTTNkesVUTablqs-THCPR2KQRB5gAc3ceA2T8E-07qkTwaYvgyCOt_Usaxh-A9qx0tcqkfSUHfwhIyNVtoW0Ura_YMCdw3RNXyw
1+
eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NzM4MTgyNDgsImV4cCI6MTc3MzgxODgxOCwiaXNzIjoiMzA1NjEyNSJ9.R8uakyVC1Av2AV23ms2WiSAAgkSmsJxcgdEDbQNs7P9S5gG_u0hXhEc0wbphU02cv1n6lxYLYQ11VkQGCusVSNRvAb0Od4POT4PRyBJmxG9fnvcPb6bqus_db9ci1DBb7lgM9Bi4wkdU__F5J4ZilOetph4On1dyfcC5kWg3-HnQjlzfNnvWpTwVsNGK9oga_u5p4DTU_r9-Jb-4BkK4YlZZrpqUtZV1_dByZXxUw7v-7egg-IdeEAoO_B6OFsKYRzy1U5zBnEQDs93UJtEMh89nj9_w2RBjcYnOlLcPndefh60WZv9Fm1lYXuJUxQa0eAdba16g5ukTv-o48TpNjw

src/page-layouts/plp/Components/add-to-cart/add-to-cart.jsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ const AddToCart = ({
4848
}) => {
4949
const fpi = useFPI();
5050
const [foLoading, setFoLoading] = useState(false);
51+
const [isLoadingCart, setIsLoadingCart] = useState(false);
52+
53+
const handleCheckout = async (event, isBuyNow) => {
54+
setIsLoadingCart(true);
55+
try {
56+
await addProductForCheckout(event, selectedSize, isBuyNow);
57+
} finally {
58+
setIsLoadingCart(false);
59+
}
60+
};
5161
const { language, countryCode } =
5262
useGlobalStore(fpi.getters.i18N_DETAILS) || {};
5363
const locale = language?.locale ? language?.locale : "en";
@@ -410,11 +420,9 @@ const AddToCart = ({
410420
<FyButton
411421
variant="outlined"
412422
size="medium"
413-
onClick={(event) =>
414-
addProductForCheckout(event, selectedSize, false)
415-
}
423+
onClick={(event) => handleCheckout(event, false)}
416424
startIcon={<CartIcon className={styles.cartIcon} />}
417-
disabled={!isServiceable}
425+
disabled={isLoadingCart || !isServiceable}
418426
>
419427
{t("resource.cart.add_to_cart_caps")}
420428
</FyButton>
@@ -426,11 +434,9 @@ const AddToCart = ({
426434
className={styles.buyNow}
427435
variant="contained"
428436
size="medium"
429-
onClick={(event) =>
430-
addProductForCheckout(event, selectedSize, true)
431-
}
437+
onClick={(event) => handleCheckout(event, true)}
432438
startIcon={<BuyNowIcon className={styles.cartIcon} />}
433-
disabled={!isServiceable}
439+
disabled={isLoadingCart || !isServiceable}
434440
>
435441
{t("resource.common.buy_now_caps")}
436442
</FyButton>

0 commit comments

Comments
 (0)