Skip to content

Commit

Permalink
feat(types): add types for helper functions (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmsk authored and pi0 committed Dec 27, 2018
1 parent 3164d8f commit 79909cc
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion 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 {
Expand All @@ -10,6 +10,15 @@ interface NuxtAxiosInstance extends AxiosInstance {
$post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
$put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>
$patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>

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<T = any>(callback: (response: AxiosResponse<T>) => 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' {
Expand Down

0 comments on commit 79909cc

Please sign in to comment.