Refactor: update beer style, brewery post services

This commit is contained in:
Aaron William Po
2023-12-14 22:18:59 -05:00
parent 0de4697e77
commit 70a168df92
26 changed files with 671 additions and 633 deletions

View File

@@ -1,4 +1,3 @@
import getBreweryPostById from '@/services/posts/brewery-post/getBreweryPostById';
import BreweryPostQueryResult from '@/services/posts/brewery-post/schema/BreweryPostQueryResult';
import { GetServerSideProps, NextPage } from 'next';
@@ -13,6 +12,7 @@ import { Tab } from '@headlessui/react';
import dynamic from 'next/dynamic';
import { MAPBOX_ACCESS_TOKEN } from '@/config/env';
import { CldImage } from 'next-cloudinary';
import { getBreweryPostByIdService } from '@/services/posts/brewery-post';
const [BreweryInfoHeader, BreweryBeersSection, BreweryCommentsSection, BreweryPostMap] = [
dynamic(() => import('@/components/BreweryById/BreweryInfoHeader')),
@@ -114,7 +114,9 @@ const BreweryByIdPage: NextPage<BreweryPageProps> = ({ breweryPost, mapboxToken
export const getServerSideProps: GetServerSideProps<BreweryPageProps> = async (
context,
) => {
const breweryPost = await getBreweryPostById(context.params!.id! as string);
const breweryPost = await getBreweryPostByIdService({
breweryPostId: context.params?.id as string,
});
const mapboxToken = MAPBOX_ACCESS_TOKEN;
return !breweryPost