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.

45 lines
1.2 KiB

  1. import React from 'react';
  2. import Navbar from "@/components/_App/NavbarYamaha";
  3. import Footer from "@/components/_App/FooterYamaha";
  4. import PageBanner from '@/components/Common/PageBanner';
  5. import ContactUs from '@/components/Yamaha/ContactUs/ContactUs';
  6. import Cookies from "cookies";
  7. const Contact = function ({ user, ...props }) {
  8. return (
  9. <>
  10. <Navbar username={user} />
  11. <PageBanner pageTitle="Contact Us" />
  12. <ContactUs />
  13. <Footer />
  14. </>
  15. )
  16. }
  17. export async function getServerSideProps(context) {
  18. var { req, resp } = context;
  19. const cookies = new Cookies(req, resp);
  20. var user = "";
  21. var userObj = (await cookies.get("user"))
  22. ? JSON.parse(await cookies.get("user"))
  23. : null;
  24. if (userObj) {
  25. let sessionId = userObj["partners_login_states"].filter(function (i) {
  26. return (
  27. i.business_partner && i.business_partner.name.toUpperCase() == "YAMAHA"
  28. );
  29. });
  30. if (sessionId.length != 0) user = userObj["username"];
  31. }
  32. return {
  33. props: { user }, // will be passed to the page component as props
  34. };
  35. }
  36. export default Contact;