Code Snippet Server

by ngeojiajun
Verified
import { GoogleAuthService } from "./google-auth-service.js"; import { google } from "googleapis"; export abstract class GoogleBaseService { protected auth = GoogleAuthService.getInstance(); constructor() { // Ensure auth is initialized before using any Google service this.initializeAuth().catch((error) => { console.error("Failed to initialize Google auth:", error); throw error; }); } private async initializeAuth(): Promise<void> { await this.auth.initialize(); await this.auth.authenticate(); } protected async waitForInit(): Promise<void> { await this.initializeAuth(); } }