@inventorjs/api-service
Version:
Api service manager base on axios
37 lines (36 loc) • 870 B
JavaScript
/**
* internal defaults
*/
import { RuntimeRequestInterceptor, RuntimeResponseInterceptor, } from './interceptors.js';
import { uuid, isBrowser } from './util.js';
class DefaultLogger {
static debug(msg) {
console.debug.call(this, msg);
}
static log(msg) {
console.info.call(this, msg);
}
static warn(msg) {
console.warn.call(this, msg);
}
static error(msg) {
console.warn.call(this, msg);
}
}
export const defaults = {
timeout: 10000,
maxRedirects: 0,
$runtime: {},
$ext: {
observe: 'body',
retry: 0,
genReqId: uuid,
logger: isBrowser()
? false
: {
logger: DefaultLogger,
},
requestInterceptors: [RuntimeRequestInterceptor],
responseInterceptors: [RuntimeResponseInterceptor],
},
};