Use tRPC for group create form (#250)

This commit is contained in:
Sebastien Castiel
2024-10-19 21:48:17 -04:00
committed by GitHub
parent 210c12b7ef
commit 2281316d58
6 changed files with 49 additions and 23 deletions

View File

@@ -5,16 +5,9 @@ import { trpc } from '@/trpc/client'
export const EditGroup = ({ groupId }: { groupId: string }) => {
const { data, isLoading } = trpc.groups.get.useQuery({ groupId })
const { mutateAsync, isPending } = trpc.groups.update.useMutation()
const { mutateAsync } = trpc.groups.update.useMutation()
const utils = trpc.useUtils()
// async function updateGroupAction(values: unknown, participantId?: string) {
// 'use server'
// const groupFormValues = groupFormSchema.parse(values)
// const group = await updateGroup(groupId, groupFormValues, participantId)
// redirect(`/groups/${group.id}`)
// }
if (isLoading) return <></>
return (

View File

@@ -40,10 +40,10 @@ export default function GroupInformation({ groupId }: { groupId: string }) {
<Skeleton className="h-3 w-3/4" />
<Skeleton className="h-3 w-1/2" />
</div>
) : data.group.information ? (
<p className="text-foreground">{data.group.information}</p>
) : (
data.group.information || (
<p className="text-muted-foreground text-sm">{t('empty')}</p>
)
<p className="text-muted-foreground text-sm">{t('empty')}</p>
)}
</CardContent>
</Card>