From 79909cc3ba72e7367c06bb60b48b36b029011c07 Mon Sep 17 00:00:00 2001 From: Kengo Hamasaki Date: Thu, 27 Dec 2018 09:20:55 -0800 Subject: [PATCH] feat(types): add types for helper functions (#193) --- index.d.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index f710ad5..b0b4093 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -import { AxiosInstance, AxiosRequestConfig } from 'axios' +import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios' import Vue from 'vue' interface NuxtAxiosInstance extends AxiosInstance { @@ -10,6 +10,15 @@ interface NuxtAxiosInstance extends AxiosInstance { $post(url: string, data?: any, config?: AxiosRequestConfig): Promise $put(url: string, data?: any, config?: AxiosRequestConfig): Promise $patch(url: string, data?: any, config?: AxiosRequestConfig): Promise + + setHeader(name: string, value?: string | false, scopes?: string | string[]): void; + setToken(token: string | false, type?: string, scopes?: string | string[]): void; + + onRequest(callback: (config: AxiosRequestConfig) => void): void; + onResponse(callback: (response: AxiosResponse) => void): void; + onError(callback: (error: AxiosError) => void): void; + onRequestError(callback: (error: AxiosError) => void): void; + onResponseErro(callback: (error: AxiosError) => void): void; } declare module 'vue/types/vue' {