export class CsrfService { private static instance: CsrfService; private csrfToken: string | null = null; private constructor() {} public static getInstance(): CsrfService { if (!CsrfService.instance) { CsrfService.instance = new CsrfService(); } return CsrfService.instance; } public async refreshCsrfToken(): Promise { // Placeholder: fetch from backend if needed // this.csrfToken = ... } public getCsrfHeaders(): Record { if (!this.csrfToken) { return {}; } return { 'X-CSRF-Token': this.csrfToken, }; } public clearCsrfToken(): void { this.csrfToken = null; } } export const csrfService = CsrfService.getInstance();