Skip to content

Commit

Permalink
fix(useFetch): return PromiseLike after setting method (#1571)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyzerner committed May 16, 2022
1 parent fe58f8a commit 9b28628
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/core/useFetch/index.ts
Expand Up @@ -481,7 +481,13 @@ export function useFetch<T>(url: MaybeRef<string>, ...args: any[]): UseFetchRetu
if (!payloadType && unref(payload) && Object.getPrototypeOf(unref(payload)) === Object.prototype)
config.payloadType = 'json'

return shell as any
return {
...shell,
then(onFulfilled: any, onRejected: any) {
return waitUntilFinished()
.then(onFulfilled, onRejected)
},
} as any
}
return undefined
}
Expand Down

0 comments on commit 9b28628

Please sign in to comment.