managing rsvps

This commit is contained in:
briannelson95
2025-06-28 20:23:22 -04:00
parent dee9066c91
commit 28efa115ad
19 changed files with 568 additions and 197 deletions

View File

@@ -9,16 +9,13 @@ export default async function SingleEventPage({ params }: { params: { eventId: s
console.log(data)
return (
<div>
<div className='max-w-[100rem] mx-auto'>
{data ? (
// @ts-ignore
<EventInfoDisplay event={data} />
) : (
<p className="text-center text-gray-500 mt-10">Event not found.</p>
)}
{data?.name && (
<HeadingWithEdit title={data?.name} eventId={data.id} />
)}
</div>
)
}

View File

@@ -1,32 +0,0 @@
'use client'
import { useState } from 'react';
import { useRouter } from 'next/navigation';
export default function CreateEventPage() {
const [name, setName] = useState('');
const router = useRouter();
async function handleSubmit(e: React.FormEvent) {
e.preventDefault();
const res = await fetch('/api/events', {
method: 'POST',
body: JSON.stringify({ name }),
});
const data = await res.json();
router.push(`/events/${data.id}`);
}
return (
<form onSubmit={handleSubmit} className="max-w-md space-y-4">
<h2 className="text-xl font-bold">Create Event</h2>
<input
type="text"
placeholder="Event Name"
className="input input-bordered w-full"
value={name}
onChange={(e) => setName(e.target.value)}
/>
<button className="btn btn-primary">Create</button>
</form>
);
}