UNPKG

@magicbell/react-headless

Version:
23 lines 621 B
import humps from 'humps'; import { fetchAPI } from '../../lib/ajax.js'; /** * Class to interact with the config API endpoint. * * @example * const repo = new ConfigRepository(); * const config = await repo.get(); */ export default class ConfigRepository { remotePathOrUrl; constructor(remotePathOrUrl = '/config') { this.remotePathOrUrl = remotePathOrUrl; } /** * Get the configuration from the API server. */ async get() { const json = await fetchAPI(this.remotePathOrUrl); return humps.camelizeKeys(json); } } //# sourceMappingURL=ConfigRepository.js.map