mirror of
https://github.com/spliit-app/spliit.git
synced 2026-03-04 20:06:11 +01:00
Use tRPC for group create form (#250)
This commit is contained in:
committed by
GitHub
parent
210c12b7ef
commit
2281316d58
@@ -1,15 +1,10 @@
|
||||
import { GroupForm } from '@/components/group-form'
|
||||
import { createGroup } from '@/lib/api'
|
||||
import { groupFormSchema } from '@/lib/schemas'
|
||||
import { redirect } from 'next/navigation'
|
||||
import { CreateGroup } from '@/app/groups/create/create-group'
|
||||
import { Metadata } from 'next'
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Create Group',
|
||||
}
|
||||
|
||||
export default function CreateGroupPage() {
|
||||
async function createGroupAction(values: unknown) {
|
||||
'use server'
|
||||
const groupFormValues = groupFormSchema.parse(values)
|
||||
const group = await createGroup(groupFormValues)
|
||||
redirect(`/groups/${group.id}`)
|
||||
}
|
||||
|
||||
return <GroupForm onSubmit={createGroupAction} />
|
||||
return <CreateGroup />
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user