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 rivi
4.9 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 HeaderLinks from \"components/Header/HeaderLinks.js\";\nimport Footer from \"components/Footer/Footer.js\";\nimport DataProduct from \"pages-sections/yamaha/product/product.js\";\nimport Parallax from \"components/Parallax/Parallax.js\";\nimport styles from \"assets/jss/nextjs-material-kit/pages/components.js\";\nimport Cookies from \"cookies\";\nimport Getproduct from \"../../../api/product/product.js\";\nconst useStyles = makeStyles(styles);\n\nconst Product = function (_ref) {\n let {\n backend,\n maxi,\n matic,\n naked,\n sport,\n offroad,\n moped,\n monsterenergy,\n cbu,\n user\n } = _ref,\n props = _objectWithoutProperties(_ref, [\"backend\", \"maxi\", \"matic\", \"naked\", \"sport\", \"offroad\", \"moped\", \"monsterenergy\", \"cbu\", \"user\"]);\n\n const classes = useStyles();\n const rest = Object.assign({}, props);\n return __jsx(\"div\", null, __jsx(Header, _extends({\n leftLinks: __jsx(HeaderLinks, {\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/Promotion_2-1.jpg\"),\n width: \"200px\"\n }), __jsx(\"div\", {\n className: classNames(classes.main, classes.mainRaised)\n }, __jsx(DataProduct, {\n maxi: maxi,\n matic: matic,\n naked: naked,\n sport: sport,\n offroad: offroad,\n moped: moped,\n monsterenergy: monsterenergy,\n cbu: cbu,\n backend: backend\n })), __jsx(Footer, null));\n};\n\nexport default Product;\nexport async function getServerSideProps(context) {\n var maxi = [];\n var matic = [];\n var naked = [];\n var sport = [];\n var offroad = [];\n var moped = [];\n var monsterenergy = [];\n var cbu = [];\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() == \"YAMAHA\";\n });\n if (sessionId.length != 0) user = userObj[\"username\"];\n }\n\n var res = await Getproduct.GetProductMaxi();\n\n if (res[\"STATUS\"] === 1) {\n maxi = res[\"DATA\"][\"products\"];\n }\n\n var res = await Getproduct.GetProductMatic();\n\n if (res[\"STATUS\"] === 1) {\n matic = res[\"DATA\"][\"products\"];\n }\n\n var res = await Getproduct.GetProductNaked();\n\n if (res[\"STATUS\"] === 1) {\n naked = res[\"DATA\"][\"products\"];\n }\n\n var res = await Getproduct.GetProductSport();\n\n if (res[\"STATUS\"] === 1) {\n sport = res[\"DATA\"][\"products\"];\n }\n\n var res = await Getproduct.GetProductOffRoad();\n\n if (res[\"STATUS\"] === 1) {\n offroad = res[\"DATA\"][\"products\"];\n }\n\n var res = await Getproduct.GetProductMoped();\n\n if (res[\"STATUS\"] === 1) {\n moped = res[\"DATA\"][\"products\"];\n }\n\n var res = await Getproduct.GetProductMonsterEnergy();\n\n if (res[\"STATUS\"] === 1) {\n monsterenergy = res[\"DATA\"][\"products\"];\n }\n\n var res = await Getproduct.GetProductCBU();\n\n if (res[\"STATUS\"] === 1) {\n cbu = res[\"DATA\"][\"products\"];\n }\n\n return {\n props: {\n maxi,\n matic,\n naked,\n sport,\n offroad,\n moped,\n monsterenergy,\n cbu,\n backend,\n user\n } // will be passed to the page component as props\n\n };\n}","map":null,"metadata":{},"sourceType":"module"}