@summpot/axios-tauri-api-adapter
TypeScript icon, indicating that this package has built-in type declarations

0.2.3 • Public • Published

axios-tauri-api-adapter

Makes it easy to use Axios in Tauri App

Installation

npm install axios-tauri-api-adapter

Usage

TypeScript / JavaScript

import axios from 'axios';
import axiosTauriApiAdapter from 'axios-tauri-api-adapter';
const client = axios.create({ adapter: axiosTauriApiAdapter });

Tauri App

Add the following configuration to the tauri.config.json See Details

{
  "tauri": {
    "allowlist": {
      "http": {
        "all": true, // Use this flag to enable all HTTP API features.
        "request": true, // Allows making HTTP requests.
        "scope": ["https://example.com/*"] // access scope for the HTTP APIs.
      }
    }
  }
}

Features

  • HTTP Requests use @tauri-apps/api/http instead of XHR(XMLHttpRequest)
  • Add config.jwt It's going to add JWT to the header

Resources

Package Sidebar

Install

npm i @summpot/axios-tauri-api-adapter

Weekly Downloads

0

Version

0.2.3

License

MIT

Unpacked Size

8.83 kB

Total Files

5

Last publish

Collaborators

  • summpot