Registry / security / axios-es6-class

axios-es6-class

JSON →
library6.0.1jsnpmunverified

axios-es6-class is a TypeScript module that wraps axios (v0.21.1) into an ES6 class, enabling a class-based API for HTTP requests with interceptors. v6.0.1 ships TypeScript types, requiring axios as a peer dependency. It differentiates from raw axios by providing a class structure that developers can extend, centralizing config, interceptors, and auth logic. Low download count; primarily for learning or small projects.

npm install axios-es6-class
INSTALL
IMPORT
SIG · AXIOS-ES6-CLASS
A
axios-es6-class
securityjavascriptv6.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Api
import { Api } from 'axios-es6-class'
const Api = require('axios-es6-class').Api
Package is ESM-only; named export.
default
import axiosEs6Class from 'axios-es6-class'
const axiosEs6Class = require('axios-es6-class')
Default export is the same Api class; avoid destructuring wrong.
Api
import { Api } from 'axios-es6-class'
import Api from 'axios-es6-class'
Default export is the class itself; both work but named import is preferred.

Shows how to extend the Api class, create a UserApi with login method, and make a POST request.

import { Api } from 'axios-es6-class'; const axios = require('axios'); // Not needed, Api uses axios internally class UserApi extends Api { constructor(config) { super(config); } login(credentials: any) { return this.post('/users', credentials).then((response: any) => response.data); } } const config = { baseURL: 'https://api.example.com', timeout: 10000 }; const userApi = new UserApi(config); userApi.login({ username: 'test', password: '123' }) .then((data: any) => console.log(data));
Debug
Known issues
breakingPackage has zero dependents and limited maintenance; use at own risk.
fix
Consider using raw axios or a well-maintained wrapper like axios-class (not this one).
affects: >=0.0.0
deprecatedaxios peer dependency is fixed at 0.21.1, which is outdated; newer axios versions may introduce incompatibilities.
fix
Update peer dependency or use axios 0.21.1 explicitly.
affects: >=6.0.0
gotchaThe Api class exposes interceptors directly via `this.interceptors`, but the interceptor implementation may have issues (e.g., spreading param with defaults incorrectly).
fix
Test interceptor logic thoroughly; consider using axios interceptors directly.
affects: >=6.0.0
gotchaTypeScript types may not exactly match axios versions; type errors possible with newer axios types.
fix
Declare your own types for axios config/responses if needed.
affects: >=6.0.0
Errors
Common errors & fixes
Error: Cannot find module 'axios-es6-class'
Package not installed or typo in import path.
fix
Run: npm install axios-es6-class
TypeError: Class extends value undefined is not a constructor or null
Default import used as named import incorrectly; e.g., `import { Api } from 'axios-es6-class'` when only default export exists.
fix
Use: import Api from 'axios-es6-class' or import { Api } from 'axios-es6-class' (both work if named export exists).
Upgrade
Version history
6.0.1latest on npm
Audit
Dependencies
axiosrequiredCore HTTP client, peer dependency at version 0.21.1
Agent activity
26 hits · last 30 days
node
24
Amazon
1
Resources
axios-es6-class — npm install axios-es6-class · libregistry