mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
docs: fix fetch composable examples (#20603)
This commit is contained in:
parent
c536e5a635
commit
ecb2fda113
@ -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
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user