@mdrakibul8001/axios

1.0.1 • Public • Published

What is this?

JWT authentication with axios in nextjs.

Installation

npm i @mdrakibul8001/axios

Usage

import MRIAxios from '@mdrakibul8001/axios';

const {http} = MRIAxios();

  async function submitForm(e) {
    e.preventDefault();

    let body={...employee, action:"addEmployee"}

      await http.post(`URL`, body)
      .then((res)=>{
          console.log(res.data.data)

      }).catch((err)=>{
        console.log(err)
      });

  }

Create Token

  const {http,saveToken,user} = MRIAxios();

  http.post(`URL`,{email:email, password:password}).then((res)=>{
    saveToken(res.data.data, res.data.response);
  })

Options

const {http,saveToken,getToken,user,token,logout} = MRIAxios();

Readme

Keywords

Package Sidebar

Install

npm i @mdrakibul8001/axios

Weekly Downloads

1

Version

1.0.1

License

ISC

Unpacked Size

3.08 kB

Total Files

3

Last publish

Collaborators

  • mdrakibul8001