Skip to content

Commit

Permalink
fix(useFetch): mark isFinished, isFetching readonly (#3616)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
baboon-king and antfu committed Feb 20, 2024
1 parent 2f66e6f commit 31d4a49
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/core/useFetch/index.ts
@@ -1,14 +1,14 @@
import type { EventHookOn, Fn, MaybeRefOrGetter, Stoppable } from '@vueuse/shared'
import { containsProp, createEventHook, toRef, toValue, until, useTimeoutFn } from '@vueuse/shared'
import type { ComputedRef, Ref } from 'vue-demi'
import { computed, isRef, ref, shallowRef, watch } from 'vue-demi'
import { computed, isRef, readonly, ref, shallowRef, watch } from 'vue-demi'
import { defaultWindow } from '../_configurable'

export interface UseFetchReturn<T> {
/**
* Indicates if the fetch request has finished
*/
isFinished: Ref<boolean>
isFinished: Readonly<Ref<boolean>>

/**
* The statusCode of the HTTP fetch response
Expand All @@ -33,7 +33,7 @@ export interface UseFetchReturn<T> {
/**
* Indicates if the request is currently being fetched.
*/
isFetching: Ref<boolean>
isFetching: Readonly<Ref<boolean>>

/**
* Indicates if the fetch request is able to be aborted
Expand Down Expand Up @@ -528,12 +528,12 @@ export function useFetch<T>(url: MaybeRefOrGetter<string>, ...args: any[]): UseF
)

const shell: UseFetchReturn<T> = {
isFinished,
isFinished: readonly(isFinished),
isFetching: readonly(isFetching),
statusCode,
response,
error,
data,
isFetching,
canAbort,
aborted,
abort,
Expand Down

0 comments on commit 31d4a49

Please sign in to comment.