-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
45 lines (42 loc) · 1.25 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
versal(key: string, defaultValue: any, isJson?: boolean): any;
// Local State
setState(key: string, val: any): string;
getState(key: string): string;
watchState(key: string, handler: (newValue: any) => void): any;
// Cookies
setCookie(key: string, val: any, options?: object): any;
getCookie(key: string, isJson?: boolean): any;
// Local Storage
setLocalStorage(key: string, val: any, isJson?: boolean): any;
getLocalStorage(key: string, isJson?: boolean): any;
}
export interface Auth {
ctx: any;
$state: any;
$storage: Storage;
user: Partial;
loggedIn: boolean;
loginWith(strategyName: string, ...args: any): Promise;
login(...args: any): Promise;
logout(): Promise;
fetchUser(): Promise;
fetchUserOnce(): Promise;
hasScope(scopeName: string): boolean;
setToken(strategyName: string, token?: string): string;
getToken(strategyName: string): string;
syncToken(strategyName: string): string;
onError(handler: (error: Error, name: string, endpoint: any) => void): any;
setUser(user?: Partial): any;
reset(): Promise;
redirect(name: string): any;
}
declare module 'vue/types/options' {
interface ComponentOptions {
auth?: boolean | string;
}
}
declare module 'vue/types/vue' {
interface Vue {
$auth: Auth;
}
}