docs: sync `useAsyncData` and `useFetch` types (#20935)

This commit is contained in:
Jongmin Yoon 2023-05-19 03:54:06 +09:00 committed by GitHub
parent 4ec2fcb750
commit da29ac0b7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View File

@ -28,19 +28,17 @@ type AsyncDataOptions<DataT> = {
immediate?: boolean immediate?: boolean
} }
interface RefreshOptions {
dedupe?: boolean
}
type AsyncData<DataT, ErrorT> = { type AsyncData<DataT, ErrorT> = {
data: Ref<DataT | null> data: Ref<DataT | null>
pending: Ref<boolean> pending: Ref<boolean>
execute: () => Promise<void> refresh: (opts?: AsyncDataExecuteOptions) => Promise<void>
refresh: (opts?: RefreshOptions) => Promise<void> execute: (opts?: AsyncDataExecuteOptions) => Promise<void>
error: Ref<ErrorT | null> error: Ref<ErrorT | null>
};
interface AsyncDataExecuteOptions {
dedupe?: boolean
} }
``` ```
## Params ## Params

View File

@ -29,12 +29,16 @@ type UseFetchOptions = {
watch?: WatchSource[] watch?: WatchSource[]
} }
type AsyncData<DataT> = { type AsyncData<DataT, ErrorT> = {
data: Ref<DataT> data: Ref<DataT | null>
pending: Ref<boolean> pending: Ref<boolean>
refresh: (opts?: { dedupe?: boolean }) => Promise<void> refresh: (opts?: AsyncDataExecuteOptions) => Promise<void>
execute: () => Promise<void> execute: (opts?: AsyncDataExecuteOptions) => Promise<void>
error: Ref<Error | boolean> error: Ref<ErrorT | null>
}
interface AsyncDataExecuteOptions {
dedupe?: boolean
} }
``` ```