title: Call get method from JS and return just string
body: <p>I am not a JS developer and I have a simple question. I have an endpoint that returns a token as a string. I wrote this method</p>
  <pre><code>async function login() {
      let response = await fetch(&quot;generate&quot;);
      return response.data;
  }
  
  getUserToken: async function () {
          var token = login()
          console.log(&quot;token: &quot;+ token)
          console.log(&quot;token.data: &quot;+ token.data)
          console.log(&quot;token.body: &quot;+ token.body)
          console.log(&quot;token.json(): &quot;+ token.json())
          return token;
      }
  </code></pre>
  <p>And I have this log</p>
  <pre><code>token: [object Promise]
  token.data: undefined
  token.body: undefined
  </code></pre>
  <p>When I call this method in the browser I get my string: <code>fgfgxfgfgfgxcfg</code></p>
  <p>How can I get this string from JS?</p>