Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

42 строки
1.1 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 LatestNewsDetail from '@/components/Yamaha/LatestNews/LatestNewsDetail';
  6. import GetLatestNews from "api/latest_news/news.js"
  7. const NewsDetail = function ({ backend, news, othernews, ...props }) {
  8. return (
  9. <>
  10. <Navbar />
  11. <LatestNewsDetail news={news} othernews={othernews} backend={backend} />
  12. <Footer />
  13. </>
  14. )
  15. }
  16. export default NewsDetail;
  17. export async function getServerSideProps(context) {
  18. var {query} = context;
  19. var news = [];
  20. var othernews = [];
  21. const backend = process.env.BACKEND_SERVER_URI;
  22. var res = await GetLatestNews.GetDetailNews(query.s||0);
  23. if (res["STATUS"] === 1) {
  24. news = res["DATA"]["latestNews"];
  25. }
  26. var res = await GetLatestNews.GetOtherNewsYamaha();
  27. if (res["STATUS"] === 1) {
  28. othernews = res["DATA"]["latestNews"];
  29. }
  30. return {
  31. props: { news, othernews, backend }, // will be passed to the page component as props
  32. };
  33. }