File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import { IInitialState } from 'interfaces/state';
1313
1414// import animationData from 'lottie/loader.json';
1515import successAnimation from 'lottie/success.json' ;
16+ import { cacheRemove } from 'utils/cacheRemove' ;
1617
1718type Inputs = {
1819 quantity : Number ;
@@ -67,6 +68,7 @@ const Card: FC<IProduct> = (product) => {
6768 } ;
6869
6970 const imageUrl = product . image . url ;
71+ const httpsImage = cacheRemove ( imageUrl ) ;
7072 const price = product . price_range . maximum_price . final_price . value ;
7173
7274 if ( product . stock_status === 'OUT_OF_STOCK' ) {
@@ -90,7 +92,7 @@ const Card: FC<IProduct> = (product) => {
9092 < div className = 'card-body' >
9193 < h5 className = 'card-title' > { product . name } </ h5 >
9294 </ div >
93- < img src = { imageUrl } className = 'img-fluid' alt = { product . name } />
95+ < img src = { httpsImage } className = 'img-fluid' alt = { product . name } />
9496 < div className = 'card-body text-center' >
9597 < p className = 'card-text' >
9698 < strong > Rs. { price } </ strong > { ' ' }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { TCart } from 'interfaces/cart';
22import { useSelector } from 'react-redux' ;
33import { IInitialState } from 'interfaces/state' ;
44import { motion } from 'framer-motion' ;
5+ import { cacheRemove } from 'utils/cacheRemove' ;
56
67type Inputs = {
78 cart_item_id : string ;
@@ -32,7 +33,7 @@ const CartItems = ({
3233 ( state : IInitialState ) => state
3334 ) ;
3435
35- let {
36+ const {
3637 product : {
3738 name,
3839 price_range : { maximum_price } ,
@@ -43,19 +44,17 @@ const CartItems = ({
4344 } ,
4445 } = cartItem ;
4546
46- let final_price = maximum_price . final_price . value ;
47- let total_price = value ;
47+ const final_price = maximum_price . final_price . value ;
48+ const total_price = value ;
49+
50+ const httpsImage = cacheRemove ( cartItem . product . thumbnail . url ) ;
4851
4952 return (
5053 < motion . tr key = { cartItem . id } variants = { item } >
5154 < td className = 'col-sm-8 col-md-6' >
5255 < div className = 'media' >
5356 < a className = 'thumbnail pull-left' href = '#' >
54- < img
55- className = 'media-object'
56- width = { 60 }
57- src = { cartItem . product . thumbnail . url }
58- />
57+ < img className = 'media-object' width = { 60 } src = { httpsImage } />
5958 </ a >
6059 < div className = 'media-body ml-3 pt-4' >
6160 < h6 className = 'media-heading' > { name } </ h6 >
Original file line number Diff line number Diff line change 1+ const regexCacheRemove = / \/ c a c h e \/ [ a - z 0 - 9 ] * \/ / g;
2+
3+ export const cacheRemove = ( url : string ) => {
4+ return url . replace ( 'http:' , 'https:' ) . replace ( regexCacheRemove , '/' ) ;
5+ } ;
You can’t perform that action at this time.
0 commit comments