From 4168d227d3d743ba447e6b0fcb97d556fc0ef071 Mon Sep 17 00:00:00 2001
From: Jowi <83415433+JowiAoun@users.noreply.github.com>
Date: Sun, 4 Aug 2024 00:47:04 -0400
Subject: [PATCH] Attempt to deploy to netlify
---
src/app/_components/post.tsx | 55 ----------------------------------
src/server/api/routers/post.ts | 41 -------------------------
2 files changed, 96 deletions(-)
delete mode 100644 src/app/_components/post.tsx
delete mode 100644 src/server/api/routers/post.ts
diff --git a/src/app/_components/post.tsx b/src/app/_components/post.tsx
deleted file mode 100644
index cf74fac7..00000000
--- a/src/app/_components/post.tsx
+++ /dev/null
@@ -1,55 +0,0 @@
-'use client'
-
-import { useState } from 'react'
-
-import { api } from '~/trpc/react'
-
-export function LatestPost() {
- const [latestPost] = api.post.getLatest.useSuspenseQuery()
-
- const utils = api.useUtils()
- const [name, setName] = useState('')
- const createPost = api.post.create.useMutation({
- onSuccess: async () => {
- await utils.post.invalidate()
- setName('')
- },
- })
-
- return (
-
- {latestPost
- ? (
-
- Your most recent post:
- {latestPost.name}
-
- )
- : (
-
You have no posts yet.
- )}
-
-
- )
-}
diff --git a/src/server/api/routers/post.ts b/src/server/api/routers/post.ts
deleted file mode 100644
index 463e06f7..00000000
--- a/src/server/api/routers/post.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { z } from 'zod'
-
-import {
- createTRPCRouter,
- protectedProcedure,
- publicProcedure,
-} from '~/server/api/trpc'
-
-export const postRouter = createTRPCRouter({
- hello: publicProcedure
- .input(z.object({ text: z.string() }))
- .query(({ input }) => {
- return {
- greeting: `Hello ${input.text}`,
- }
- }),
-
- create: protectedProcedure
- .input(z.object({ name: z.string().min(1) }))
- .mutation(async ({ ctx, input }) => {
- await new Promise(resolve => setTimeout(resolve, 1000)) // simulate a slow db call
-
- return ctx.db.post.create({
- data: {
- name: input.name,
- createdBy: { connect: { id: ctx.session.user.id } },
- },
- })
- }),
-
- getLatest: protectedProcedure.query(({ ctx }) => {
- return ctx.db.post.findFirst({
- orderBy: { createdAt: 'desc' },
- where: { createdBy: { id: ctx.session.user.id } },
- })
- }),
-
- getSecretMessage: protectedProcedure.query(() => {
- return 'you can now see this secret message!'
- }),
-})