text: "use strict";var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard");Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=Products;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=_interopRequireWildcard(require("react"));var _reactNative=require("react-native");var _Components=require("../../Components");var _Helix=_interopRequireWildcard(require("../../Services/Helix"));var _jsxFileName="/home/matheus/Projects/SmartMarket/src/Pages/Products/index.js";function Products(_ref){var _this=this;var navigation=_ref.navigation;var _useState=(0,_react.useState)([]),_useState2=(0,_slicedToArray2["default"])(_useState,2),products=_useState2[0],setProducts=_useState2[1];(0,_react.useEffect)(function(){console.log(products.length);function loadProducts(){var response;return _regenerator["default"].async(function loadProducts$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return _regenerator["default"].awrap(_Helix["default"].get("".concat(_Helix.Entities,"/?type=Product")));case 3:response=_context.sent;if(response.status==200){setProducts(response.data);}_context.next=10;break;case 7:_context.prev=7;_context.t0=_context["catch"](0);console.log("deu erro!!!",_context.t0);case 10:case"end":return _context.stop();}}},null,null,[[0,7]]);}loadProducts();},[]);return _react["default"].createElement(_Components.Container,{__self:this,__source:{fileName:_jsxFileName,lineNumber:32,columnNumber:9}},_react["default"].createElement(_reactNative.ScrollView,{__self:this,__source:{fileName:_jsxFileName,lineNumber:33,columnNumber:13}},_react["default"].createElement(_Components.PageTitle,{text:"Produtos",__self:this,__source:{fileName:_jsxFileName,lineNumber:34,columnNumber:17}}),products.map(function(product,key){return _react["default"].createElement(_Components.ProductCard,{key:key,Title:product.name.value,Price:product.price.value,Id:product.id,__self:_this,__source:{fileName:_jsxFileName,lineNumber:38,columnNumber:24}});})));}