diff --git a/lib/googlecalendar.ts b/lib/googlecalendar.ts index 2ffd100..7b67182 100644 --- a/lib/googlecalendar.ts +++ b/lib/googlecalendar.ts @@ -2,7 +2,7 @@ import { google } from 'googleapis' import { Booking } from '../db/booking' const calendarId = process.env.GOOGLE_CALENDAR_ID -let credentials +let credentials: object try { credentials = JSON.parse(process.env.GOOGLE_SERVICE_ACCOUNT_KEY_JSON); @@ -45,9 +45,7 @@ function getSummary(booking: Partial): string { } export async function createCalendarEvent(booking: Booking): Promise { - const authInstance = await auth.getClient(); const response = await calendar.events.insert({ - auth: authInstance, calendarId, requestBody: { summary: getSummary(booking), @@ -64,7 +62,6 @@ export async function createCalendarEvent(booking: Booking): Promise { export async function deleteCalendarEvent(booking: Booking) { await calendar.events.delete({ - auth, calendarId, eventId: booking.calendarEventId, }) @@ -74,7 +71,6 @@ export async function deleteCalendarEvent(booking: Booking) { //export async function patchCalendarEvent(booking: { calendarEventId: string } & Partial ) : Promise { // const response = await calendar.events.patch({ -// auth, // calendarId, // eventId: booking.calendarEventId, // });