amplitudeRepo.ts
3 months ago
formsRepo.ts
6 months ago
hostingRepo.ts
3 months ago
index.ts
3 months ago
pagesRepo.ts
10 months ago
reachRepo.ts
1 month ago
amplitudeRepo.ts
20 lines
| 1 | import { useGeneralDataStore } from '@/stores'; |
| 2 | import { Header } from '@/types/enums'; |
| 3 | import type { AmplitudeEvent } from '@/types/enums/amplitudeEnum'; |
| 4 | import httpService from '@/utils/services/httpService'; |
| 5 | |
| 6 | const URL = `${hostinger_reach_reach_data.rest_base_url}hostinger-amplitude/v1`; |
| 7 | export const amplitudeRepo = { |
| 8 | postHostingerAmplitude: (action: AmplitudeEvent, properties?: { [key: string]: unknown }) => { |
| 9 | const { nonce } = useGeneralDataStore(); |
| 10 | |
| 11 | return httpService.post<boolean>( |
| 12 | `${URL}/hostinger-amplitude-event`, |
| 13 | { params: { action, ...properties } }, |
| 14 | { |
| 15 | headers: { [Header.WP_NONCE]: nonce } |
| 16 | } |
| 17 | ); |
| 18 | } |
| 19 | }; |
| 20 |