You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
3.4 KiB

  1. {"ast":null,"code":"var __jsx = React.createElement;\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React from \"react\";\nimport classNames from \"classnames\";\nimport { makeStyles } from \"@material-ui/core/styles\";\nimport Header from \"components/Header/Header.js\";\nimport HeaderHonda from \"components/Header/HeaderHonda.js\";\nimport FooterHonda from \"components/Footer/FooterHonda.js\";\nimport DataProduct from \"pages-sections/honda/product/product.js\";\nimport Parallax from \"components/Parallax/Parallax.js\";\nimport styles from \"assets/jss/nextjs-material-kit/pages/components.js\";\nimport Getproduct from \"api/product/product.js\";\nimport Cookies from \"cookies\";\nconst useStyles = makeStyles(styles);\n\nconst Product = function (_ref) {\n let {\n backend,\n car,\n user\n } = _ref,\n props = _objectWithoutProperties(_ref, [\"backend\", \"car\", \"user\"]);\n\n const classes = useStyles();\n const rest = Object.assign({}, props);\n return __jsx(\"div\", null, __jsx(Header, _extends({\n rightLinks: __jsx(HeaderHonda, {\n username: user\n }),\n fixed: true,\n color: \"info\",\n changeColorOnScroll: {\n height: 400,\n color: \"white\"\n }\n }, rest)), __jsx(Parallax, {\n image: require(\"assets/img/honda.jpg\"),\n width: \"200px\"\n }), __jsx(\"div\", {\n className: classNames(classes.main, classes.mainRaised)\n }, __jsx(DataProduct, {\n car: car,\n backend: backend\n })), __jsx(FooterHonda, null));\n};\n\nexport default Product;\nexport async function getServerSideProps(context) {\n var car = [];\n const backend = process.env.BACKEND_SERVER_URI;\n var {\n req,\n resp\n } = context;\n const cookies = new Cookies(req, resp);\n var user = \"\";\n var userObj = (await cookies.get(\"user\")) ? JSON.parse(await cookies.get(\"user\")) : null;\n\n if (userObj) {\n let sessionId = userObj[\"partners_login_states\"].filter(function (i) {\n return i.business_partner && i.business_partner.name.toUpperCase() == \"HONDA\";\n });\n if (sessionId.length != 0) user = userObj[\"username\"];\n }\n\n var res = await Getproduct.GetProductHonda();\n\n if (res[\"STATUS\"] === 1) {\n car = res[\"DATA\"][\"products\"];\n }\n\n return {\n props: {\n car,\n backend,\n user\n } // will be passed to the page component as props\n\n };\n}","map":null,"metadata":{},"sourceType":"module"}