mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Refactor api requests and components out of pages
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import BeerForm from '@/components/BeerForm';
|
||||
import Layout from '@/components/Layout';
|
||||
import Layout from '@/components/ui/Layout';
|
||||
import DBClient from '@/prisma/DBClient';
|
||||
import getAllBreweryPosts from '@/services/BreweryPost/getAllBreweryPosts';
|
||||
import BreweryPostQueryResult from '@/services/BreweryPost/types/BreweryPostQueryResult';
|
||||
@@ -16,14 +16,13 @@ interface CreateBeerPageProps {
|
||||
const Create: NextPage<CreateBeerPageProps> = ({ breweries, types }) => {
|
||||
return (
|
||||
<Layout>
|
||||
<div className="align-center my-12 flex h-full flex-col items-center justify-center">
|
||||
<div className="align-center my-20 flex h-fit flex-col items-center justify-center">
|
||||
<div className="w-8/12">
|
||||
<div className="flex flex-col items-center space-y-1">
|
||||
<BiBeer className="text-5xl" />
|
||||
<h1 className="text-3xl font-bold">Create a New Beer</h1>
|
||||
</div>
|
||||
|
||||
<BeerForm type="create" breweries={breweries} types={types} />
|
||||
<BeerForm formType="create" breweries={breweries} types={types} />
|
||||
</div>
|
||||
</div>
|
||||
</Layout>
|
||||
@@ -32,8 +31,8 @@ const Create: NextPage<CreateBeerPageProps> = ({ breweries, types }) => {
|
||||
|
||||
export const getServerSideProps = async () => {
|
||||
const breweryPosts = await getAllBreweryPosts();
|
||||
|
||||
const beerTypes = await DBClient.instance.beerType.findMany();
|
||||
|
||||
return {
|
||||
props: {
|
||||
breweries: JSON.parse(JSON.stringify(breweryPosts)),
|
||||
|
||||
Reference in New Issue
Block a user