Guest User

Untitled

a guest
Oct 24th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. <div>
  2. <strong>Data 01</strong>
  3. </div>
  4.  
  5. <div>
  6. <strong>Data 02</strong>
  7. </div>
  8.  
  9. <div>
  10. <strong>Data 03</strong>
  11. </div>
  12.  
  13. <div>
  14. <strong>Data 01</strong>
  15. <strong>Data 02</strong>
  16. <strong>Data 03</strong>
  17. </div>
  18.  
  19. import React from 'react';
  20. import ContentSkuInfo from './CallDataStorage';
  21.  
  22. const ContenidoUno = (props) => {
  23. return (
  24. <div className="contentBox outerBox-first" >
  25. <a href={props.link}>
  26. <img src={props.imagen} alt="bloque 01" className="img-wrap" />
  27. </a>
  28. <h3>{props.categoria}</h3>
  29. <img src={props.icono} className="iconic" alt="producto" />
  30. <span>{props.descripcion}</span>
  31. <ContentSkuInfo />
  32. <small>Antes: ${props.antes}</small>
  33. <div className="containerBotonRow">
  34. <a href={props.link}><button className="botonRow">¡Lo quiero!</button></a>
  35. </div>
  36. </div>
  37. );
  38. }
  39.  
  40. export default ContenidoUno;
  41.  
  42. import React from 'react';
  43. import axios from 'axios';
  44.  
  45. var productsIds = ['3552357', '2635968BC', '3181464', '3593754'];
  46. var productsIdsJoin = productsIds.join('-');
  47.  
  48. const getProductDetailAPI = (productsIds, storeId) => ({
  49. method: 'GET',
  50. baseURL:`SORRY CAN'T SHOW THIS`,
  51. auth: {
  52. username: 'XXXXXXX',
  53. password: 'XXXXXXX',
  54. },
  55. headers: {
  56. 'Content-Type': 'application/json',
  57. },
  58. data: {},
  59. });
  60.  
  61. const ContentSkuInfo = (props) => {
  62. return (
  63. <strong>$ {props.prodsNormal}</strong>
  64. );
  65. }
  66.  
  67. class DataStorage extends React.Component {
  68.  
  69. constructor(props) {
  70. super(props);
  71. this.state = { products: [] };
  72. };
  73.  
  74. getWebServiceResponse = (currentList, storeId) => (
  75. axios(getProductDetailAPI(currentList, storeId))
  76. .then(response => response.data)
  77. .then(newData => {
  78. this.setState({ products: newData.productDetailsJson })
  79. })
  80. .catch(e => e)
  81. );
  82.  
  83. componentDidMount() {
  84. this.getWebServiceResponse(productsIdsJoin, 96);
  85. };
  86.  
  87. render() {
  88. return (
  89. <samp>
  90. {this.state.products.map(skuData =>
  91. <ContentSkuInfo
  92. prodsName={skuData.name}
  93. prodsId={skuData.productId}
  94. prodsStatus={skuData.status}
  95. prodsPublished={skuData.published}
  96. prodsNormal={skuData.NORMAL}
  97. prodsCMR={skuData.CMR}
  98. prodsAhorro={skuData.savings}
  99. prodsCombo={skuData.combo}
  100. prodsStock={skuData.stockLevel}
  101. />
  102. )
  103. }
  104. </samp>
  105. )
  106. }
  107. }
  108.  
  109. export default DataStorage;
Add Comment
Please, Sign In to add comment