Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
fix: hash pure array
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Nov 15, 2022
1 parent c9ef662 commit 4826776
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/nuxt/src/app/composables/fetch.ts
@@ -1,7 +1,6 @@
import type { FetchError, FetchOptions } from 'ofetch'
import type { TypedInternalResponse, NitroFetchRequest } from 'nitropack'
import { computed, unref, Ref, reactive } from 'vue'
import { withBase, withQuery } from 'ufo'
import { hash } from 'ohash'
import type { AsyncDataOptions, _Transform, KeyOfRes, AsyncData, PickFrom } from './asyncData'
import { useAsyncData } from './asyncData'
Expand Down Expand Up @@ -46,7 +45,7 @@ export function useFetch<
arg2?: string
) {
const [opts = {}, autoKey] = typeof arg1 === 'string' ? [{}, arg1] : [arg1, arg2]
const _key = opts.key || (typeof request === 'string' ? hash(withBase(unref(opts.baseURL) || '', withQuery(request as string, unref(opts.params) || {}))) : autoKey)
const _key = opts.key || hash([autoKey, unref(opts.baseURL), typeof request === 'string' ? request : '', unref(opts.params)])
if (!_key || typeof _key !== 'string') {
throw new TypeError('[nuxt] [useFetch] key must be a string: ' + _key)
}
Expand Down

0 comments on commit 4826776

Please sign in to comment.