UNPKG

@fmdevui/fm-dev

Version:

Page level components developed based on Element Plus.

40 lines (39 loc) 1.37 kB
import { AxiosInstance, AxiosRequestConfig } from 'axios'; export interface CustomAxiosRequestConfig extends AxiosRequestConfig { loading?: boolean; } export declare const service: AxiosInstance; export declare const accessTokenKey: string; export declare const refreshAccessTokenKey: string; export declare const getToken: () => any; export declare const clearTokens: () => void; export declare const clearAccessTokens: () => void; export declare const axiosInstance: AxiosInstance; export declare const cancelRequest: (url: string | string[]) => void; export declare const cancelAllRequest: () => void; /** * 参数处理 * @param {*} params 参数 */ export declare function tansParams(params: any): string; /** * 解密 JWT token 的信息 * @param token jwt token 字符串 * @returns <any>object */ export declare function decryptJWT(token: string): any; /** * 将 JWT 时间戳转换成 Date * @description 主要针对 `exp`,`iat`,`nbf` * @param timestamp 时间戳 * @returns Date 对象 */ export declare function getJWTDate(timestamp: number): Date; /** * Ajax请求,如果成功返回result字段,如果不成功提示错误信息 * @description Ajax请求 * @config AxiosRequestConfig 请求参数 * @returns 返回对象 */ export declare function request2(config: CustomAxiosRequestConfig): any; export default service;