refactor(nuxt): simplify request computation (#26191)

This commit is contained in:
Alex Liu 2024-03-12 00:33:39 +08:00 committed by GitHub
parent 5d3cbff6ac
commit 79cdb0b881
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,13 +94,7 @@ export function useFetch<
) {
const [opts = {}, autoKey] = typeof arg1 === 'string' ? [{}, arg1] : [arg1, arg2]
const _request = computed(() => {
let r = request
if (typeof r === 'function') {
r = r()
}
return toValue(r)
})
const _request = computed(() => toValue(request))
const _key = opts.key || hash([autoKey, typeof _request.value === 'string' ? _request.value : '', ...generateOptionSegments(opts)])
if (!_key || typeof _key !== 'string') {