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 981 B
import { USER_PROFILE_ENDPOINTS } from '@cranberry-money/shared-constants'; let configuredApiClient = null; export const configureUsers = (apiClient) => { configuredApiClient = apiClient; }; const getConfiguredClient = () => { if (!configuredApiClient) { throw new Error('Users service not configured. Call configureUsers(apiClient) before using users functions.'); } return configuredApiClient; }; export const createUserProfile = (data) => { return getConfiguredClient().post(USER_PROFILE_ENDPOINTS.BASE, data); }; export const updateUserProfile = (uuid, data) => { return getConfiguredClient().patch(`${USER_PROFILE_ENDPOINTS.BASE}${uuid}/`, data); }; export const updateUserProfileCompletion = (uuid, data) => { return getConfiguredClient().patch(`${USER_PROFILE_ENDPOINTS.BASE}${uuid}/`, data); }; export const getUserProfiles = () => { return getConfiguredClient().get(USER_PROFILE_ENDPOINTS.BASE); }; //# sourceMappingURL=users.js.map