選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

86 行
2.4 KiB

  1. import React from "react";
  2. import classNames from "classnames";
  3. import { makeStyles } from "@material-ui/core/styles";
  4. import Header from "components/Header/Header.js";
  5. import HeaderLinks from "components/Header/HeaderLinks.js";
  6. import Footer from "components/Footer/Footer.js";
  7. import Parallax from "components/Parallax/Parallax.js";
  8. import styles from "assets/jss/nextjs-material-kit/pages/components.js";
  9. import SectionCarrer from "pages-sections/yamaha/carrer/carrer.js";
  10. import Getcarrer from "../../../api/carrer/carrer.js"
  11. import Cookies from "cookies";
  12. import stylecss from "pages/home.css";
  13. const useStyles = makeStyles(styles);
  14. const Carrer = function ({ user, backend, s1, d3, sma, ...props }) {
  15. const classes = useStyles();
  16. const { ...rest } = props;
  17. return (
  18. <div>
  19. <Header
  20. leftLinks={<HeaderLinks username={user} />}
  21. fixed
  22. color="info"
  23. changeColorOnScroll={{
  24. height: 400,
  25. color: "white"
  26. }}
  27. {...rest}
  28. />
  29. <Parallax image={require("assets/img/carrer.png")} height="50px" />
  30. <div className={classNames(classes.main, classes.mainRaised)}>
  31. <SectionCarrer s1={s1} d3={d3} sma={sma} backend={backend} />
  32. <a href="https://wa.me/+6287797315685" class="float" target="_blank">
  33. <i class="fa fa-whatsapp my-float"></i>
  34. </a>
  35. </div>
  36. <Footer />
  37. </div>
  38. );
  39. }
  40. export default Carrer;
  41. export async function getServerSideProps(context) {
  42. var s1 = [];
  43. var d3 = [];
  44. var sma = [];
  45. const backend = process.env.BACKEND_SERVER_URI;
  46. var { req, resp } = context;
  47. const cookies = new Cookies(req, resp);
  48. var user = "";
  49. var userObj = (await cookies.get("user"))
  50. ? JSON.parse(await cookies.get("user"))
  51. : null;
  52. if (userObj) {
  53. let sessionId = userObj["partners_login_states"].filter(function (i) {
  54. return (
  55. i.business_partner && i.business_partner.name.toUpperCase() == "YAMAHA"
  56. );
  57. });
  58. if (sessionId.length != 0) user = userObj["username"];
  59. }
  60. var res = await Getcarrer.GetCarrerS1Yamaha();
  61. if (res["STATUS"] === 1) {
  62. s1 = res["DATA"]["carrers"];
  63. }
  64. var res = await Getcarrer.GetCarrerD3Yamaha();
  65. if (res["STATUS"] === 1) {
  66. d3 = res["DATA"]["carrers"];
  67. }
  68. var res = await Getcarrer.GetCarrerSMAYamaha();
  69. if (res["STATUS"] === 1) {
  70. sma = res["DATA"]["carrers"];
  71. }
  72. return {
  73. props: { user, s1, d3, sma, backend }, // will be passed to the page component as props
  74. };
  75. }