Skip to content

Commit

Permalink
docs: fix fetch composable examples (#20603)
Browse files Browse the repository at this point in the history
  • Loading branch information
enkot committed May 1, 2023
1 parent c536e5a commit ecb2fda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/3.api/1.composables/use-fetch.md
Expand Up @@ -114,7 +114,7 @@ const { data, pending, error, refresh } = await useFetch('/api/auth/login', {
},
onResponse({ request, response, options }) {
// Process the response data
return response._data
localStorage.setItem('token', response._data.token)
},
onResponseError({ request, response, options }) {
// Handle the response errors
Expand Down
Expand Up @@ -15,12 +15,12 @@ export function useCustomFetch<T> (url: string, options: UseFetchOptions<T> = {}
? { Authorization: `Bearer ${userAuth.value}` }
: {},

onResponse (__ctx) {
// return new myBusinessResponse(response._data)
onResponse (_ctx) {
// _ctx.response._data = new myBusinessResponse(_ctx.response._data)
},

onResponseError (__ctx) {
// return new myBusinessError(error)
onResponseError (_ctx) {
// throw new myBusinessError()
}
}

Expand Down

0 comments on commit ecb2fda

Please sign in to comment.