Skip to content
Permalink
Browse files

feat(types): add types for helper functions (#193)

  • Loading branch information...
hmsk authored and pi0 committed Dec 27, 2018
1 parent 3164d8f commit 79909cc3ba72e7367c06bb60b48b36b029011c07
Showing with 10 additions and 1 deletion.
  1. +10 −1 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<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' {

0 comments on commit 79909cc

Please sign in to comment.
You can’t perform that action at this time.