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

    @dasdarki/axiox

Axoix is an enhancement for axios which adds features like simpler error handling.


Version published
Weekly downloads
3
increased by200%
Maintainers
1
Install size
797 kB
Created
Weekly downloads
 

Readme

Source

axiox Npm package version

Axoix is an enhancement for axios which adds features like simpler error handling.

npm i @dasdarki/axiox axios

Usage

Import Axiox function from the library:

import Axiox from '@dasdarki/axiox';

Create axios instance (optional):

const axios = axios.create({});

Initialize Axiox Client:

const axioxClient = Axiox(axios);

Make a request:

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:

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 for creating the axios REST client

Keywords

FAQs

Last updated on 15 Jul 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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