From 90d06c15c7b139b016e9494f1ce18989c1a3e8ab Mon Sep 17 00:00:00 2001 From: Kappaccinoh Date: Mon, 19 Jun 2023 11:28:36 +0800 Subject: [PATCH] yarn build and yarn start working --- src/components/attendance/DataTableModal.tsx | 8 +++----- src/pages/events/[id].tsx | 4 ++-- src/pages/events/attendance/[id].tsx | 2 +- src/server/trpc/router/attendance/index.ts | 2 ++ src/server/trpc/router/event/deleteEvent.ts | 4 ---- src/server/trpc/router/event/updateEvent.ts | 7 ------- 6 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/components/attendance/DataTableModal.tsx b/src/components/attendance/DataTableModal.tsx index 5843e9ff..abe48f92 100644 --- a/src/components/attendance/DataTableModal.tsx +++ b/src/components/attendance/DataTableModal.tsx @@ -22,11 +22,10 @@ import dayjs from 'dayjs' import Image from 'next/image' import { type BodyProps } from '~/types/event/event.type' import Link from 'next/link' -import { useRouter } from 'next/navigation' const DataTableModal = () => { const modal = useContext(ModalContext) - const { data, isLoading } = trpc.attendance.getEventForUser.useQuery(modal.id) + const { data, isLoading } = trpc.event.getEvent.useQuery(modal.id) if (!modal.id) { return null @@ -55,6 +54,8 @@ const DataTableModal = () => { } const Body: React.FC<{ data: BodyProps | null | undefined }> = ({ data }) => { + const modal = useContext(ModalContext) + const toast = useToast() if (!data) { return
No Event Found
} @@ -62,10 +63,7 @@ const Body: React.FC<{ data: BodyProps | null | undefined }> = ({ data }) => { dayjs.extend(LocalizedFormat) const startDate = dayjs(data.startDate).format('lll') const endDate = dayjs(data.endDate).format('lll') - const router = useRouter() - const toast = useToast() - const modal = useContext(ModalContext) const { mutateAsync, isLoading: isSubmitting } = trpc.event.deleteEvent.useMutation() const confirmDelete = async() => { try { diff --git a/src/pages/events/[id].tsx b/src/pages/events/[id].tsx index 9677f976..8f93afda 100644 --- a/src/pages/events/[id].tsx +++ b/src/pages/events/[id].tsx @@ -21,7 +21,6 @@ import Container from '~/components/auth/Container' import { useRouter } from 'next/router' import TopNavbar from '~/components/common/TopNavbar' import withAuth, { type BaseProps } from '~/utils/withAuth' -import { query } from 'firebase/firestore' const EventPage: React.FC = ({ session }) => { const router = useRouter() @@ -76,8 +75,9 @@ const EventPage: React.FC = ({ session }) => { if (invalidAttendees) { return false } + await mutateAsync({ - id: eventData.id, + id: eventData!.id!, name: formData.eventName, startDate: new Date(formData.startDate), endDate: new Date(formData.endDate), diff --git a/src/pages/events/attendance/[id].tsx b/src/pages/events/attendance/[id].tsx index b43cfc32..853c1049 100644 --- a/src/pages/events/attendance/[id].tsx +++ b/src/pages/events/attendance/[id].tsx @@ -87,7 +87,7 @@ const ConfirmAttendance: React.FC = ({ session }) => { {data.name}

- {dayjs(data.startDate.toDate()).format('lll')} + {dayjs(data.startDate).format('lll')}

{ const data = await userCollection.getById(attendee) @@ -42,8 +38,6 @@ export const updateEvent = protectedProcedure }) ) - const eventID = - await eventCollection.update(input.id, { attendees: 0, endDate: Timestamp.fromDate(input.endDate), @@ -51,7 +45,6 @@ export const updateEvent = protectedProcedure invitedAttendees: users, name: input.name, startDate: Timestamp.fromDate(input.startDate), - qrCode: qr_code || '', }) } catch (e) { await logCollection.add({