0.2.8 • Published 5 months ago

@types/axios-token-interceptor v0.2.8

Weekly downloads
1,837
License
MIT
Repository
github
Last release
5 months ago

Installation

npm install --save @types/axios-token-interceptor

Summary

This package contains type definitions for axios-token-interceptor (https://github.com/sandrinodimattia/axios-token-interceptor#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/axios-token-interceptor.

index.d.ts

// Type definitions for axios-token-interceptor 0.2
// Project: https://github.com/sandrinodimattia/axios-token-interceptor#readme
// Definitions by: Vivint Team Innovation <https://github.com/innovation-team>
//                 Mike Dodge <https://github.com/mgdodge>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3

import { AxiosRequestConfig } from 'axios';

// Module
declare function AxiosTokenProvider(Options: AxiosTokenProvider.InterceptorOptions): AxiosTokenProvider.TokenProvider;
declare namespace AxiosTokenProvider {
    function tokenCache<T>(getToken: () => Promise<T>, options: TokenCacheOptions<T>): TokenCache;

    // Interfaces
    interface InterceptorOptions<T = unknown> {
        token?: string | undefined;
        getToken?: (() => string | Promise<string>) | undefined;
        header?: string | undefined;
        headerFormatter?: ((token: T) => string) | undefined;
    }

    type TokenProvider = (config: AxiosRequestConfig) => Promise<AxiosRequestConfig>;

    interface TokenCacheOptions<T = unknown> {
        getMaxAge?: (() => number) | ((el: T) => number) | undefined;
        maxAge?: number | undefined;
    }

    interface TokenCache {
        (): Promise<string>;
        reset(): void;
    }
}
export = AxiosTokenProvider;

Additional Details

  • Last updated: Sun, 26 Sep 2021 14:31:24 GMT
  • Dependencies: @types/axios
  • Global values: none

Credits

These definitions were written by Vivint Team Innovation, and Mike Dodge.

0.2.8

5 months ago

0.2.7

6 months ago

0.2.6

7 months ago

0.2.5

8 months ago

0.2.4

1 year ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago