[id].js 1007 Bytes
import React, { useEffect } from "react";
import { useDispatch } from "react-redux";
import Detail from "../../components/detail/Detail";
import Layout from "../../components/layout/Layout";
import { getActivitiesByFilters, getActivityById } from "../../redux/actions/activityAction";
import { loadUser } from "../../redux/actions/userActions";
import { wrapper } from "../../redux/store";
import { getFaqs } from "../../redux/actions/faqsAction";

const ActivityDetailPage = () => {
  const dispatch = useDispatch();
  useEffect(() => {
    dispatch(loadUser());
  }, []);

  return (
    <Layout>
      <Detail />
    </Layout>
  );
};

export default ActivityDetailPage;

/** For server side rendering */
export const getServerSideProps = wrapper.getServerSideProps(store => async ({ req, query }) => {
  await store.dispatch(getActivityById(query.id));
  await store.dispatch(getFaqs());
  //   await store.dispatch(getActivitiesByFilters({category: query.category}))

  return {
    props: {}
  };
});