import axios, { AxiosInstance } from 'axios'; export interface IConfigBot { token: string; dateLifetimeJwt: Date; } export interface IBotLink { link: string; } export class ConfigBotApi { private static instance: ConfigBotApi | null = null; private httpBotInstance: AxiosInstance; private constructor() { const isServer = typeof window === 'undefined'; const baseURL = isServer ? 'http://127.0.0.1:3001' : process.env.NEXT_PUBLIC_BOT_API; this.httpBotInstance = axios.create({ baseURL, headers: { 'ngrok-skip-browser-warning': 'true', }, }); } public static getInstance(): ConfigBotApi { if (this.instance) return this.instance; this.instance = new ConfigBotApi(); return this.instance; } async getConfigBot(): Promise { return (await this.httpBotInstance.get(`/config-bot-data`)).data; } async getBotLink(): Promise { return (await this.httpBotInstance.get(`/link-bot`)).data; } }