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
}
interface RefreshOptions {
dedupe?: boolean
}
type AsyncData<DataT, ErrorT> = {
data: Ref<DataT | null>
pending: Ref<boolean>
execute: () => Promise<void>
refresh: (opts?: RefreshOptions) => Promise<void>
refresh: (opts?: AsyncDataExecuteOptions) => Promise<void>
execute: (opts?: AsyncDataExecuteOptions) => Promise<void>
error: Ref<ErrorT | null>
};
interface AsyncDataExecuteOptions {
dedupe?: boolean
}
```
## Params

View File

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