Socket
Socket
Sign inDemoInstall

@dasdarki/axiox

Package Overview
Dependencies
8
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

11

package.json
{
"name": "@dasdarki/axiox",
"version": "1.0.0",
"version": "1.0.1",
"description": "Axoix is an enhancement for axios which adds features like simpler error handling.",

@@ -9,3 +9,3 @@ "main": "dist/index.js",

"build": "tsc",
"publish": "npm pack && npm publish --access=public"
"publish": "npm publish --access=public"
},

@@ -16,3 +16,8 @@ "repository": {

},
"keywords": ["axios", "rest", "api", "axiox"],
"keywords": [
"axios",
"rest",
"api",
"axiox"
],
"author": "Polaryx",

@@ -19,0 +24,0 @@ "license": "MIT",

@@ -1,5 +0,44 @@

# axiox
# axiox [![Npm package version](https://badgen.net/npm/v/@dasdarki/axiox)](https://npmjs.com/package/@dasdarki/axiox)
Axoix is an enhancement for [axios](https://github.com/axios/axios) which adds features like simpler error handling.
```shell
npm i @dasdarki/axiox axios
```
## Usage
Import Axiox function from the library:
```js
import Axiox from '@dasdarki/axiox';
```
Create axios instance (optional):
```js
const axios = axios.create({});
```
Initialize Axiox Client:
```js
const axioxClient = Axiox(axios);
```
Make a request:
```js
axioxClient.get('https://api.some-url.com/some-path')
.then(response => {
// next step
})
.catch(error => {
console.log(error);
});
```
Handle the response with conditional response handling:
```js
response.when()
.success(() => { /* SUCCESS (status code >= 200) */ })
.and(c => c.status(400).data('message', 'Username does not exist'), () => { /* BAD REQUEST */ })
.and(c => c.status(400).data('message', 'Email does not exist'), () => { /* BAD REQUEST */ })
```
## Credits
- [axios](https://github.com/axios) for creating the axios REST client
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc