import { useGeneralDataStore } from '@/stores/generalDataStore'; import { Header } from '@/types/enums'; import type { AuthorizeRequestHeaders, ContactList, Form, FormsFilter, IntegrationsResponse } from '@/types/models'; import { generateCorrelationId } from '@/utils/helpers'; import httpService from '@/utils/services/httpService'; const URL = `${hostinger_reach_reach_data.rest_base_url}hostinger-reach/v1`; export const formsRepo = { getForms: (filters: FormsFilter = {}, headers?: AuthorizeRequestHeaders) => { const { nonce } = useGeneralDataStore(); const params = new URLSearchParams(); if (filters.contactListId) { params.append('contact_list_id', filters.contactListId.toString()); } if (filters.type) { params.append('type', filters.type); } if (filters.limit) { params.append('limit', filters.limit.toString()); } if (filters.offset) { params.append('offset', filters.offset.toString()); } const queryString = params.toString() ? `?${params.toString()}` : ''; const config = { headers: { [Header.CORRELATION_ID]: headers?.[Header.CORRELATION_ID] || generateCorrelationId(), [Header.WP_NONCE]: nonce } }; return httpService.get