UNPKG

@cranberry-money/shared-services

Version:

Platform-agnostic API services with pure functions and dependency injection. Includes auth, portfolios, instruments, countries, sectors, and more.

24 lines 1.12 kB
import { INVESTMENT_PREFERENCES_ENDPOINTS } from '@cranberry-money/shared-constants'; let configuredApiClient = null; export const configureInvestmentPreferences = (apiClient) => { configuredApiClient = apiClient; }; const getConfiguredClient = () => { if (!configuredApiClient) { throw new Error('Investment preferences service not configured. Call configureInvestmentPreferences(apiClient) before using investment preferences functions.'); } return configuredApiClient; }; export const createInvestmentPreference = (data) => { return getConfiguredClient().post(INVESTMENT_PREFERENCES_ENDPOINTS.BASE, data); }; export const updateInvestmentPreference = (uuid, data) => { return getConfiguredClient().patch(INVESTMENT_PREFERENCES_ENDPOINTS.DETAIL(uuid), data); }; export const deleteInvestmentPreference = (uuid) => { return getConfiguredClient().delete(INVESTMENT_PREFERENCES_ENDPOINTS.DETAIL(uuid)); }; export const getInvestmentPreferences = () => { return getConfiguredClient().get(INVESTMENT_PREFERENCES_ENDPOINTS.BASE); }; //# sourceMappingURL=investmentPreferences.js.map