mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
fix calendar auth
This commit is contained in:
@@ -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<Booking>): string {
|
||||
}
|
||||
|
||||
export async function createCalendarEvent(booking: Booking): Promise<Booking> {
|
||||
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<Booking> {
|
||||
|
||||
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<Booking> ) : Promise<Booking> {
|
||||
// const response = await calendar.events.patch({
|
||||
// auth,
|
||||
// calendarId,
|
||||
// eventId: booking.calendarEventId,
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user