1

I'm trying to use useFetch in Nuxt3, however, the responses have a weird format.

Here is the code:

<script setup>
const [{ data: organization }, { data: repos }] = await Promise.all([
    useFetch('https://api.github.com/orgs/nuxt'),
    useFetch('https://api.github.com/orgs/nuxt/repos'),
])

console.log('--------organization', organization)
console.log('----------repos', repos)

</script>

And here is the response: enter image description here

The _rawValue and _value actually contain the data I need, however, I think this should just be a simple JSON. I'm not sure why it's returning data this way

Adam Silva
  • 1,013
  • 18
  • 48
  • 1
    Duplicate https://stackoverflow.com/questions/64960637/what-does-proxy-mean-in-the-console-in-vue-3 Don't panic with the weird object, ES6 Proxy adds reactivity to the object without interfering. You can display data normally in JavaScript: `console.log(organization.value.login);` or inside your template `{{ organization.login }}`. – Théo Naciri Feb 07 '23 at 16:15

1 Answers1

0

You can use "ToRaw()" Example :

if(isProxy(organization)) {
    data = toRaw(organization)
    console.log(data)
}