1.0.1 • Published 4 months ago

axios-instances v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

Unleash the Power of Seamless API Calls

Dive into the world of axios-instance – the React hook that turns the complexity of Axios-based API calls into a thrilling adventure! This dynamic hook effortlessly juggles the intricacies of API requests, loading states, and error handling, providing you with a hassle-free experience. But that's not all – brace yourself for a feature-packed journey with support for token authentication, payload integration, and query parameters. It's not just a hook; it's your ultimate solution for conquering a spectrum of RESTful HTTP methods like GET, POST, PUT, DELETE, and beyond!

Installation: A Swift Launchpad 🚀

Embark on your journey by installing the axios-instance package with just one command:

  npm install axios-instances

Parameters: Your Personalization Toolkit 🧰

Customize your API interactions with an array of flexible parameters:

NameDetails
methodCommand the HTTP method for your requests (e.g., "GET", "POST", etc.).
urlTarget the API endpoint you want to conquer.
headersAmplify your requests with additional headers.
queryParamsAn object containing query parameters to be included in the request URL.
payloadArm yourself with data for a victorious encounter, perfect for methods like POST or PUT.

Usage/Examples: Craft Your Epic Saga 🛡️

Witness the magic unfold in your React component with useApiRequestWithAuth:

import { useApiRequestWithAuth } from 'use-axios-hook';

const HeroicComponent = () => {
  const { data, isLoading, error } = useApiRequestWithAuth(
    'https://jsonplaceholder.typicode.com/posts',
    { method: 'GET' }
  );

  if (isLoading) {
    return <div>⌛ Loading...</div>;
  }

  if (error) {
    return <div>⚔️ Error: {error.message}</div>;
  }

  if (!data) {
    return <div>🤷‍♂️ No data available.</div>;
  }

  // Craft your component with the fetched data
  return (
    <div>
      {data.map((item: any) => (
        <div key={item.id}>{item.title}</div>
      ))}
    </div>
  );
};

Feel the thrill, customize HeroicComponent to unleash your unique use case, and let axios-instance be your trusty sidekick in this epic API saga. Your journey to API greatness starts here! 🌟

Suggestions

Suggestions are always welcome! For suggestions, email hirengohel6666@gmail.com or patelneel033@gmail.com.

Support

For support, email hirengohel6666@gmail.com or patelneel033@gmail.com.

1.0.1

4 months ago

1.0.0

4 months ago

0.0.20

4 months ago

0.0.19

4 months ago

0.0.18

7 months ago

0.0.17

10 months ago

0.0.16

10 months ago

0.0.15

10 months ago

0.0.14

10 months ago

0.0.13

10 months ago

0.0.12

10 months ago

0.0.11

10 months ago

0.0.10

10 months ago

0.0.9

10 months ago

0.0.8

10 months ago

0.0.7

10 months ago

0.0.6

10 months ago

0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago