import React from "react";
import classNames from "classnames";
import { makeStyles } from "@material-ui/core/styles";
import Header from "components/Header/Header.js";
import HeaderLinks from "components/Header/HeaderLinks.js";
import Footer from "components/Footer/Footer.js";
import DataProduct from "pages-sections/product/product.js";
import Parallax from "components/Parallax/Parallax.js";
import styles from "assets/jss/nextjs-material-kit/pages/components.js";
import Getproduct from "../api/product/product.js";
const useStyles = makeStyles(styles);
const Product = function ({
backend,
yamaha,
suzuki,
honda,
hino,
mercedes,
bpr,
emilia,
homes,
...props
}) {
const classes = useStyles();
const { ...rest } = props;
return (
}
fixed
color="info"
changeColorOnScroll={{
height: 400,
color: "white",
}}
{...rest}
/>
);
};
export default Product;
export async function getServerSideProps(context) {
var yamaha = [];
var suzuki = [];
var honda = [];
var hino = [];
var mercedes = [];
var bpr = [];
var emilia = [];
var homes = [];
const backend = process.env.BACKEND_SERVER_URI;
var res = await Getproduct.GetProductYamaha();
if (res["STATUS"] === 1) {
yamaha = res["DATA"]["products"];
}
var res = await Getproduct.GetProductSuzuki();
if (res["STATUS"] === 1) {
suzuki = res["DATA"]["products"];
}
var res = await Getproduct.GetProductHonda();
if (res["STATUS"] === 1) {
honda = res["DATA"]["products"];
}
var res = await Getproduct.GetProductHino();
if (res["STATUS"] === 1) {
hino = res["DATA"]["products"];
}
var res = await Getproduct.GetProductMercedes();
if (res["STATUS"] === 1) {
mercedes = res["DATA"]["products"];
}
var res = await Getproduct.GetProductBPR();
if (res["STATUS"] === 1) {
bpr = res["DATA"]["products"];
}
var res = await Getproduct.GetProductEmilia();
if (res["STATUS"] === 1) {
emilia = res["DATA"]["products"];
}
var res = await Getproduct.GetProductHomes();
if (res["STATUS"] === 1) {
homes = res["DATA"]["products"];
}
return {
props: {
yamaha,
suzuki,
honda,
hino,
mercedes,
bpr,
emilia,
homes,
backend,
}, // will be passed to the page component as props
};
}