/* * @Author: wjc * @Date: 2023-11-27 15:35:24 * @LastEditors: LiZhiWei * @LastEditTime: 2026-01-15 17:52:25 * @Description: */ import type { UseFetchOptions } from '#app' export type _AsyncData = { data: Ref pending: Ref refresh: (opts?: AsyncDataExecuteOptions) => Promise execute: (opts?: AsyncDataExecuteOptions) => Promise error: Ref } interface AsyncDataExecuteOptions { dedupe?: boolean } export type IInterceptor = { onRequest?: UseFetchOptions['onRequest'] onRequestError?: UseFetchOptions['onRequestError'] onResponse?: UseFetchOptions['onResponse'] onResponseError?: UseFetchOptions['onResponseError'] } export interface IConfig { baseURL: any interceptor?: IInterceptor } type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'get' | 'post' | 'put' | 'delete' export interface IOption { url: string method?: Methods params?: any // query data?: any // body options?: UseFetchOptions } export type RequestQueueItem = { url: string options: UseFetchOptions resolve: (data: T) => void reject: (data: unknown) => void }