[Vuejs]-Fetching from rest api vue

0👍

You have an ReferenceError: response is not defined because your have to declare your variable response before. So you should write :

async function fetching() {
        const  response = await fetch(url, { method, headers, body });
        return response
      }

or maybe directly (if your variable "response" is just for your function you dont’ need it)

async function fetching() {
        return await fetch(url, { method, headers, body });
      }

For the responseDataToSession , try with responseDataToSession: {} ,

Leave a comment