UNPKG

arcx

Version:

A lightweight, dependency-free fetch utility for APIs and React.

25 lines (24 loc) 762 B
/** * @module config * Contains global configuration types, defaults, and * a function to merge user-defined config. */ /** * Global configuration object, which can be updated via `configureArcX`. * Includes default values for convenience. */ export const globalConfig = { baseUrl: "", headers: {}, interceptors: {}, }; /** * Merges user-defined config into the global config. The generic type <T> ensures * that if you have a consistent response shape for global interceptors, you can * annotate it here. For most cases, using the default <unknown> is sufficient. * * @param config - Partial configuration to be merged with the global configuration. */ export function configureArcX(config) { Object.assign(globalConfig, config); }