@alauda-fe/common
Version:
Alauda frontend team common codes.
45 lines (44 loc) • 1.31 kB
TypeScript
export interface AccountInfo {
iss?: string;
sub?: string;
aud?: string;
exp?: number;
iat?: number;
azp?: string;
at_hash?: string;
email?: string;
email_verified?: true;
name?: string;
token?: string;
ext?: {
is_admin?: boolean;
conn_id?: boolean;
};
}
export interface TokenResponse {
token_storage: string;
token_type: string;
expire_at: string;
issued_at: string;
id_token?: string;
}
export declare function createAuthorizedFetchInit(init?: RequestInit): {
credentials: RequestCredentials;
headers: Headers;
body?: BodyInit | null;
cache?: RequestCache;
integrity?: string;
keepalive?: boolean;
method?: string;
mode?: RequestMode;
priority?: RequestPriority;
redirect?: RequestRedirect;
referrer?: string;
referrerPolicy?: ReferrerPolicy;
signal?: AbortSignal | null;
window?: null;
};
export declare function fetchTokenApi(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
export declare function fetchAuthorizedResource(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
export declare function requestTokenInfo(): Promise<AccountInfo | null>;
export declare function requestTokenRefresh(): Promise<TokenResponse | null>;