mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
refactor(nuxt): simplify request
computation (#26191)
This commit is contained in:
parent
5d3cbff6ac
commit
79cdb0b881
@ -94,13 +94,7 @@ export function useFetch<
|
|||||||
) {
|
) {
|
||||||
const [opts = {}, autoKey] = typeof arg1 === 'string' ? [{}, arg1] : [arg1, arg2]
|
const [opts = {}, autoKey] = typeof arg1 === 'string' ? [{}, arg1] : [arg1, arg2]
|
||||||
|
|
||||||
const _request = computed(() => {
|
const _request = computed(() => toValue(request))
|
||||||
let r = request
|
|
||||||
if (typeof r === 'function') {
|
|
||||||
r = r()
|
|
||||||
}
|
|
||||||
return toValue(r)
|
|
||||||
})
|
|
||||||
|
|
||||||
const _key = opts.key || hash([autoKey, typeof _request.value === 'string' ? _request.value : '', ...generateOptionSegments(opts)])
|
const _key = opts.key || hash([autoKey, typeof _request.value === 'string' ? _request.value : '', ...generateOptionSegments(opts)])
|
||||||
if (!_key || typeof _key !== 'string') {
|
if (!_key || typeof _key !== 'string') {
|
||||||
|
Loading…
Reference in New Issue
Block a user