Update branding.ts

This commit is contained in:
Egor
2026-01-27 01:19:05 +03:00
committed by GitHub
parent 8c2e42d42e
commit 1695247974

View File

@@ -19,6 +19,12 @@ export interface EmailAuthEnabled {
enabled: boolean
}
export interface AnalyticsCounters {
yandex_metrika_id: string
google_ads_id: string
google_ads_label: string
}
const BRANDING_CACHE_KEY = 'cabinet_branding'
const LOGO_PRELOADED_KEY = 'cabinet_logo_preloaded'
@@ -178,4 +184,20 @@ export const brandingApi = {
const response = await apiClient.patch<EmailAuthEnabled>('/cabinet/branding/email-auth', { enabled })
return response.data
},
// Get analytics counters (public, no auth required)
getAnalyticsCounters: async (): Promise<AnalyticsCounters> => {
try {
const response = await apiClient.get<AnalyticsCounters>('/cabinet/branding/analytics')
return response.data
} catch {
return { yandex_metrika_id: '', google_ads_id: '', google_ads_label: '' }
}
},
// Update analytics counters (admin only)
updateAnalyticsCounters: async (data: Partial<AnalyticsCounters>): Promise<AnalyticsCounters> => {
const response = await apiClient.patch<AnalyticsCounters>('/cabinet/branding/analytics', data)
return response.data
},
}